Skip to main content

Readable

Trait Readable 

Source
pub trait Readable<const N: usize> {
    // Required methods
    fn complete_chunks(&self) -> usize;
    fn get_chunk(&self, chunk: usize) -> [u8; N];
    fn last_chunk(&self) -> ([u8; N], u64);
    fn pruned_chunks(&self) -> usize;
    fn len(&self) -> u64;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn pruned_bits(&self) -> u64 { ... }
    fn get_bit(&self, bit: u64) -> bool { ... }
    fn ones_iter_from(&self, pos: u64) -> OnesIter<'_, Self, N> 
       where Self: Sized { ... }
}
Expand description

Read-only access to a bitmap’s chunks and metadata.

Required Methods§

Source

fn complete_chunks(&self) -> usize

Return the number of complete (fully filled) chunks.

Source

fn get_chunk(&self, chunk: usize) -> [u8; N]

Return the chunk data at the given absolute chunk index.

Source

fn last_chunk(&self) -> ([u8; N], u64)

Return the last chunk and its size in bits.

Source

fn pruned_chunks(&self) -> usize

Return the number of pruned chunks.

Source

fn len(&self) -> u64

Return the total number of bits.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the bitmap is empty.

Source

fn pruned_bits(&self) -> u64

Return the number of pruned bits (i.e. pruned chunks * bits per chunk).

Source

fn get_bit(&self, bit: u64) -> bool

Return the value of a single bit.

Source

fn ones_iter_from(&self, pos: u64) -> OnesIter<'_, Self, N>
where Self: Sized,

Returns an iterator over the indices of set bits starting from pos.

If pos falls within a pruned region, iteration starts at the first unpruned bit instead.

Implementors§

Source§

impl<const N: usize> Readable<N> for BitMap<N>

Source§

impl<const N: usize> Readable<N> for Prunable<N>