[−][src]Trait bitrush_index::Bitmap
Required methods
fn new() -> Self
Return a new bitmap.
fn set(&mut self, i: u32)
Set the ith bit (starting from zero).
fn unroll_bitmap(&self) -> Vec<u32>
Return a Vec with all bit set positions.
fn size(&self) -> usize
Return the effective size to serialize the bitmap.
fn write_to_buffer(&self, buffer_out: &mut [u8]) -> Result<usize, ()>
Write bitamp content into buffer_out and return the numbers of bytes written. Return a generic error if buffer_out size is less then bitmap size.
fn read_from_buffer(
&mut self,
buffer_in: &[u8],
check_bitmap: bool
) -> Result<(), ()>
&mut self,
buffer_in: &[u8],
check_bitmap: bool
) -> Result<(), ()>
Read bitmap content from buffer_in, buffer_in must have the effettive
bitmap content (the size returned from write_to_buffer method).
If check_bitmap == false
bitmap content is readed without
any check on bitmap content integrity. Return a generic error an error occur.
Implementors
impl Bitmap for OZBCBitmap
[src]
Impl Bitmap
to allow to use OZBCBitmap in [BitmapIndex
].
fn new() -> OZBCBitmap
[src]
Return new empty bitmap.
fn set(&mut self, i: u32)
[src]
Set the ith bit (starting from zero). You must set the bitmap in increasing
order otherwise nothing happend:
set(0), set(16), set(1000)
is the same of set(0), set(16), set(1000), set(50)
.
Example
use bitrush_index::OZBCBitmap; use bitrush_index::Bitmap; fn main() { let mut b0 = OZBCBitmap::new(); let mut b1 = b0.clone(); let values = [0, 1, 100, 100000, 2, 100001]; let values_ok = [0, 1, 100, 100000, 100001]; for val in values.iter() { b0.set(*val); } for val in values_ok.iter() { b1.set(*val); } assert_eq!(b0, b1); }
fn unroll_bitmap(&self) -> Vec<u32>
[src]
Return a vector with all positions of set bit.
fn size(&self) -> usize
[src]
Get bitmap content size.
fn write_to_buffer(&self, buffer_out: &mut [u8]) -> Result<usize, ()>
[src]
Write bitmap content into buffer_out and return the number of bytes written.
fn read_from_buffer(
&mut self,
buffer_in: &[u8],
check_bitmap: bool
) -> Result<(), ()>
[src]
&mut self,
buffer_in: &[u8],
check_bitmap: bool
) -> Result<(), ()>
Read bitmap content from buffer_in, buffer_in must have the exact length of bitmap content.