Crate yabf[−][src]
Yabf
Just what the world needed - yet another bit field struct.
This is a small and simple implementation. It only has the basic functionality of a bit field:
- Set arbitary bit (if you set the millionth bit the list will use at least 125KB of heap space)
- Get bit value
- An iterator over the set bit indices. O(size of container)
- The container never shrinks.
The bits are stored in plain (non-sparse) arrays/vectors.
use yabf::Yabf; let mut a = Yabf::default(); let mut b = Yabf::with_capacity(12345); a.set_bit(45,true); b.set_bit(12345,true); assert!(!a.bit(12345)); assert!(a.bit(45)); assert!(b.bit(12345));
use yabf::SmallYabf; let mut a = SmallYabf::default(); let mut b = SmallYabf::with_capacity(12345); a.set_bit(45,true); b.set_bit(12345,true); assert!(!a.bit(12345)); assert!(a.bit(45)); assert!(b.bit(12345));
Structs
SmallYabf | Yet another bit field implementation. This is a simple, small and hopefully efficient bit field implementation. It uses SmallVec as an internal container. The first 128 bits will be stored on the stack. |
SmallYabfIterator | Iterator over the bits set to true in the bit field container. Will iterate over the bits from lowest to to highest. This is a relatively expensive O(size of container) operation. |
Yabf | Yet another bit field implementation. This is a simple, small and hopefully efficient bit field implementation. |
YabfIterator | Iterator over the bits set to true in the bit field container. Will iterate over the bits from lowest to to highest. This is a relatively expensive O(size of container) operation. |