A small library to handle nibbles.
There are a few other libraries on Crates.io which handle nibbles.
Nothing in this library should be considered "efficient," nor "fast". It is however meant to be simple.
rust
use nibbler::traits::Nib;
use nibbler::nibble::Nibble;
let val: u8 = 10;
let mut nib: Nibble = Nibble::from(val);
assert_eq!(10, nib.into());
use nibbler::nibbles::Nibbles;
let val: u16 = 0xaa; // 10101010
let nibs: Nibbles = val.into();
assert_eq!(170, nibs.into());
For more information, see the documentation...
GPLv3