Trait bv::Bits [−][src]
pub trait Bits { type Block: BlockType; fn bit_len(&self) -> u64; fn block_len(&self) -> usize { ... } fn get_bit(&self, position: u64) -> bool { ... } fn get_block(&self, position: usize) -> Self::Block { ... } fn get_raw_block(&self, position: usize) -> Self::Block { ... } fn get_bits(&self, start: u64, count: usize) -> Self::Block { ... } fn to_bit_vec(&self) -> BitVec<Self::Block> { ... } }
Expand description
Associated Types
Required methods
Provided methods
Gets the bit at position
The default implementation calls get_block
and masks out the
correct bit.
Panics
Panics if position
is out of bounds.
Gets the block at position
, masked as necessary.
The bits are laid out Block::nbits()
per block, with the notional
zeroth bit in the least significant position. If self.bit_len()
is
not a multiple of Block::nbits()
then the last block will
contain extra zero bits that are not part of the bit vector.
The default implementation calls get_raw_block
,
but you can override with something more efficient, for example if masking
is unnecessary.
Panics
Panics if position
is out of bounds.
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]Gets the block at position
, without masking.
The default implementation of this method just delegates to [get_block
](#method
.get_block), which means it in fact does mask out extraneous bits. However, particular
implementors may override this method to provide a more efficient implementation when
one is possible.
Panics
Panics if position
is out of bounds.
Gets count
bits starting at bit index start
, interpreted as a
little-endian integer.
Panics
Panics if the bit span goes out of bounds.
fn to_bit_vec(&self) -> BitVec<Self::Block>
[src]
fn to_bit_vec(&self) -> BitVec<Self::Block>
[src]Copies the bits into a new allocated BitVec
.