[−][src]Trait bv::Bits
Read-only bit vector operations.
Minimal complete definition is:
Note that get_block
in terms of get_bit
is inefficient, and thus
you should implement get_block
directly if possible.
Associated Types
Loading content...Required methods
Loading content...Provided methods
fn block_len(&self) -> usize
The length of the slice in blocks.
fn get_bit(&self, position: u64) -> bool
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.
fn get_block(&self, position: usize) -> Self::Block
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
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.
fn get_bits(&self, start: u64, count: usize) -> Self::Block
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>
Copies the bits into a new allocated BitVec
.
Implementations on Foreign Types
impl<'a, T: Bits + ?Sized> Bits for &'a T
[src]
type Block = T::Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
impl<'a, T: Bits + ?Sized> Bits for &'a mut T
[src]
type Block = T::Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
impl<Block: BlockType> Bits for Box<dyn Bits<Block = Block>>
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
impl<Block: BlockType> Bits for Box<dyn BitsMut<Block = Block>>
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
impl<Block: BlockType> Bits for [Block]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Block
[src]
impl<Block: BlockType> Bits for Vec<Block>
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Block
[src]
fn get_raw_block(&self, position: usize) -> Block
[src]
impl Bits for [bool]
[src]
impl Bits for Vec<bool>
[src]
impl<Block: BlockType> Bits for [Block; 0]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 0]
[src]
impl<Block: BlockType> Bits for [Block; 1]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 1]
[src]
impl<Block: BlockType> Bits for [Block; 2]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 2]
[src]
impl<Block: BlockType> Bits for [Block; 3]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 3]
[src]
impl<Block: BlockType> Bits for [Block; 4]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 4]
[src]
impl<Block: BlockType> Bits for [Block; 5]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 5]
[src]
impl<Block: BlockType> Bits for [Block; 6]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 6]
[src]
impl<Block: BlockType> Bits for [Block; 7]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 7]
[src]
impl<Block: BlockType> Bits for [Block; 8]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 8]
[src]
impl<Block: BlockType> Bits for [Block; 9]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 9]
[src]
impl<Block: BlockType> Bits for [Block; 10]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 10]
[src]
impl<Block: BlockType> Bits for [Block; 11]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 11]
[src]
impl<Block: BlockType> Bits for [Block; 12]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 12]
[src]
impl<Block: BlockType> Bits for [Block; 13]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 13]
[src]
impl<Block: BlockType> Bits for [Block; 14]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 14]
[src]
impl<Block: BlockType> Bits for [Block; 15]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 15]
[src]
impl<Block: BlockType> Bits for [Block; 16]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 16]
[src]
impl<Block: BlockType> Bits for [Block; 17]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 17]
[src]
impl<Block: BlockType> Bits for [Block; 18]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 18]
[src]
impl<Block: BlockType> Bits for [Block; 19]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 19]
[src]
impl<Block: BlockType> Bits for [Block; 20]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 20]
[src]
impl<Block: BlockType> Bits for [Block; 21]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 21]
[src]
impl<Block: BlockType> Bits for [Block; 22]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 22]
[src]
impl<Block: BlockType> Bits for [Block; 23]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 23]
[src]
impl<Block: BlockType> Bits for [Block; 24]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 24]
[src]
impl<Block: BlockType> Bits for [Block; 25]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 25]
[src]
impl<Block: BlockType> Bits for [Block; 26]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 26]
[src]
impl<Block: BlockType> Bits for [Block; 27]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 27]
[src]
impl<Block: BlockType> Bits for [Block; 28]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 28]
[src]
impl<Block: BlockType> Bits for [Block; 29]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 29]
[src]
impl<Block: BlockType> Bits for [Block; 30]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 30]
[src]
impl<Block: BlockType> Bits for [Block; 31]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 31]
[src]
impl<Block: BlockType> Bits for [Block; 32]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 32]
[src]
impl<Block: BlockType> Bits for [Block; 64]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 64]
[src]
impl<Block: BlockType> Bits for [Block; 128]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 128]
[src]
impl<Block: BlockType> Bits for [Block; 256]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 256]
[src]
impl<Block: BlockType> Bits for [Block; 512]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 512]
[src]
impl<Block: BlockType> Bits for [Block; 1024]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 1024]
[src]
impl<Block: BlockType> Bits for [Block; 2048]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 2048]
[src]
impl<Block: BlockType> Bits for [Block; 4096]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 4096]
[src]
impl<Block: BlockType> Bits for [Block; 8192]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 8192]
[src]
impl<Block: BlockType> Bits for [Block; 16384]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 16384]
[src]
impl<Block: BlockType> Bits for [Block; 32768]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 32768]
[src]
impl<Block: BlockType> Bits for [Block; 65536]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 65536]
[src]
impl<Block: BlockType> Bits for [Block; 131072]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 131072]
[src]
impl<Block: BlockType> Bits for [Block; 262144]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 262144]
[src]
impl<Block: BlockType> Bits for [Block; 524288]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 524288]
[src]
impl<Block: BlockType> Bits for [Block; 1048576]
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl Bits for [bool; 1048576]
[src]
impl Bits for u8
[src]
type Block = u8
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self
[src]
impl Bits for u16
[src]
type Block = u16
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self
[src]
impl Bits for u32
[src]
type Block = u32
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self
[src]
impl Bits for u64
[src]
type Block = u64
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self
[src]
impl Bits for u128
[src]
type Block = u128
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self
[src]
impl Bits for usize
[src]
type Block = usize
fn bit_len(&self) -> u64
[src]
fn block_len(&self) -> usize
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self
[src]
Implementors
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a mut Vec<bool>>
[src]
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a [bool]>
[src]
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a mut [bool]>
[src]
impl<'a, Block: BlockType> Bits for BitSlice<'a, Block>
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Block
[src]
fn get_raw_block(&self, position: usize) -> Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
impl<'a, Block: BlockType> Bits for BitSliceMut<'a, Block>
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
impl<Block: BlockType> Bits for BitFill<Block>
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, position: u64, len: usize) -> Self::Block
[src]
impl<Block: BlockType> Bits for BoolAdapter<Block, Vec<bool>>
[src]
impl<Block: BlockType> Bits for BitVec<Block>
[src]
type Block = Block
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Block
[src]
fn get_raw_block(&self, position: usize) -> Block
[src]
impl<T, U> Bits for BitAnd<T, U> where
T: Bits,
U: Bits<Block = T::Block>,
[src]
T: Bits,
U: Bits<Block = T::Block>,
type Block = T::Block
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
impl<T, U> Bits for BitConcat<T, U> where
T: Bits,
U: Bits<Block = T::Block>,
[src]
T: Bits,
U: Bits<Block = T::Block>,
type Block = T::Block
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
impl<T, U> Bits for BitOr<T, U> where
T: Bits,
U: Bits<Block = T::Block>,
[src]
T: Bits,
U: Bits<Block = T::Block>,
type Block = T::Block
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
impl<T, U> Bits for BitXor<T, U> where
T: Bits,
U: Bits<Block = T::Block>,
[src]
T: Bits,
U: Bits<Block = T::Block>,
type Block = T::Block
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
impl<T, U, F> Bits for BitZip<T, U, F> where
T: Bits,
U: Bits<Block = T::Block>,
F: Fn(T::Block, T::Block) -> T::Block,
[src]
T: Bits,
U: Bits<Block = T::Block>,
F: Fn(T::Block, T::Block) -> T::Block,