bittle-0.3.2 has been yanked.
bittle
A library for working with bitsets.
The name bittle comes from bit and little. Small bitsets!
This crate defines the [Bits] and [OwnedBits] traits which allows for
generically interacting with and manipulating bit sets over types such as
u128, [u32; 4], or even slices like &[u8].
Usage
Add bittle to your Cargo.toml:
[]
= "0.3.2"
Examples
use mem;
use Bits;
let mut set = 0u64;
assert!;
set.set;
assert!;
set.unset;
assert!;
assert_eq!;
Some other interesting operations, such as Bits::join are available, allowing bitsets to act like masks over other iterators:
use Bits;
let elements = vec!;
let mut m = 0u128;
// Since set is empty, no elements are iterated over.
let mut it = m.join;
assert_eq!;
m.set;
let mut it = m.join;
assert_eq!;
assert_eq!;