Nibbler
A small library to handle nibbles.
There are a few other libraries on Crates.io which handle nibbles.
Efficiency
Nothing in this library should be considered "efficient," nor "fast". It is however meant to be simple.
Dependencies
- None, Nil
Only thing needed is the std::fmt::Display
(standard library) for displaying objects.
Quick Example Usage
use Nib;
use Nibble;
let val: u8 = 10;
let mut nib: Nibble = from;
assert_eq!;
use Nibbles;
let val: u16 = 0xaa; // 10101010
let nibs: Nibbles = val.into;
assert_eq!;
assert!;
assert_eq!;
assert_eq!;
assert_eq!;
let val: u16 = 0xba; // 10111010
let nibs: Nibbles = val.into;
assert_eq!;
assert!;
assert_eq!;
assert_eq!;
assert_eq!;
let val: u16 = 0xf00;
let nibs: Nibbles = val.into;
assert_eq!;
assert!;
assert!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Nibbles don't care about signing. Nibbles are just 4 bits. Signed integers are treated as unsigned integers in all conversions. You can cast back .into()
a signed integer, as available.
For more information, see the documentation... or on Crates.io ... or the repo.
Future
On the purported "todo" list is to add right and left shift, addition, subtraction, multiplication.
License
GPLv3