Struct sparse_bitfield::Bitfield
[−]
[src]
pub struct Bitfield {
pub page_size: usize,
pub pages: Pager,
// some fields omitted
}Bitfield instance.
Fields
page_size: usize
The page_size of the Page instances stored in memory-pager.
pages: Pager
A memory-pager instance.
Methods
impl Bitfield[src]
pub fn new(page_size: usize) -> Self[src]
Create a new instance.
pub fn set(&mut self, index: usize, value: bool) -> Change[src]
Set a byte to true or false. Returns a boolean indicating if the value was changed.
pub fn get(&mut self, index: usize) -> bool[src]
Get the value of a bit.
pub fn get_byte(&mut self, index: usize) -> u8[src]
Get a byte from our internal buffers.
pub fn set_byte(&mut self, index: usize, byte: u8) -> Change[src]
Set a byte to the right value inside our internal buffers.
pub fn len(&self) -> usize[src]
Get the amount of bits stored. Includes sparse spaces.
pub fn is_empty(&self) -> bool[src]
Check if length is zero.
Trait Implementations
impl Debug for Bitfield[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl Default for Bitfield[src]
Create a new instance with a page_size of 1kb.