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> { ... } }

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

The underlying block type used to store the bits of the vector.

Required Methods

The length of the slice in bits.

Provided Methods

The length of the slice in blocks.

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.

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.

Copies the bits into a new allocated BitVec.

Implementations on Foreign Types

impl<'a, T: Bits + ?Sized> Bits for &'a T
[src]

impl<'a, T: Bits + ?Sized> Bits for &'a mut T
[src]

impl<Block: BlockType> Bits for Box<Bits<Block = Block>>
[src]

impl<Block: BlockType> Bits for Box<BitsMut<Block = Block>>
[src]

impl<Block: BlockType> Bits for [Block]
[src]

impl<Block: BlockType> Bits for Vec<Block>
[src]

impl Bits for [bool]
[src]

impl Bits for Vec<bool>
[src]

impl<Block: BlockType> Bits for [Block; 0]
[src]

impl Bits for [bool; 0]
[src]

impl<Block: BlockType> Bits for [Block; 1]
[src]

impl Bits for [bool; 1]
[src]

impl<Block: BlockType> Bits for [Block; 2]
[src]

impl Bits for [bool; 2]
[src]

impl<Block: BlockType> Bits for [Block; 3]
[src]

impl Bits for [bool; 3]
[src]

impl<Block: BlockType> Bits for [Block; 4]
[src]

impl Bits for [bool; 4]
[src]

impl<Block: BlockType> Bits for [Block; 5]
[src]

impl Bits for [bool; 5]
[src]

impl<Block: BlockType> Bits for [Block; 6]
[src]

impl Bits for [bool; 6]
[src]

impl<Block: BlockType> Bits for [Block; 7]
[src]

impl Bits for [bool; 7]
[src]

impl<Block: BlockType> Bits for [Block; 8]
[src]

impl Bits for [bool; 8]
[src]

impl<Block: BlockType> Bits for [Block; 9]
[src]

impl Bits for [bool; 9]
[src]

impl<Block: BlockType> Bits for [Block; 10]
[src]

impl Bits for [bool; 10]
[src]

impl<Block: BlockType> Bits for [Block; 11]
[src]

impl Bits for [bool; 11]
[src]

impl<Block: BlockType> Bits for [Block; 12]
[src]

impl Bits for [bool; 12]
[src]

impl<Block: BlockType> Bits for [Block; 13]
[src]

impl Bits for [bool; 13]
[src]

impl<Block: BlockType> Bits for [Block; 14]
[src]

impl Bits for [bool; 14]
[src]

impl<Block: BlockType> Bits for [Block; 15]
[src]

impl Bits for [bool; 15]
[src]

impl<Block: BlockType> Bits for [Block; 16]
[src]

impl Bits for [bool; 16]
[src]

impl<Block: BlockType> Bits for [Block; 17]
[src]

impl Bits for [bool; 17]
[src]

impl<Block: BlockType> Bits for [Block; 18]
[src]

impl Bits for [bool; 18]
[src]

impl<Block: BlockType> Bits for [Block; 19]
[src]

impl Bits for [bool; 19]
[src]

impl<Block: BlockType> Bits for [Block; 20]
[src]

impl Bits for [bool; 20]
[src]

impl<Block: BlockType> Bits for [Block; 21]
[src]

impl Bits for [bool; 21]
[src]

impl<Block: BlockType> Bits for [Block; 22]
[src]

impl Bits for [bool; 22]
[src]

impl<Block: BlockType> Bits for [Block; 23]
[src]

impl Bits for [bool; 23]
[src]

impl<Block: BlockType> Bits for [Block; 24]
[src]

impl Bits for [bool; 24]
[src]

impl<Block: BlockType> Bits for [Block; 25]
[src]

impl Bits for [bool; 25]
[src]

impl<Block: BlockType> Bits for [Block; 26]
[src]

impl Bits for [bool; 26]
[src]

impl<Block: BlockType> Bits for [Block; 27]
[src]

impl Bits for [bool; 27]
[src]

impl<Block: BlockType> Bits for [Block; 28]
[src]

impl Bits for [bool; 28]
[src]

impl<Block: BlockType> Bits for [Block; 29]
[src]

impl Bits for [bool; 29]
[src]

impl<Block: BlockType> Bits for [Block; 30]
[src]

impl Bits for [bool; 30]
[src]

impl<Block: BlockType> Bits for [Block; 31]
[src]

impl Bits for [bool; 31]
[src]

impl<Block: BlockType> Bits for [Block; 32]
[src]

impl Bits for [bool; 32]
[src]

impl<Block: BlockType> Bits for [Block; 64]
[src]

impl Bits for [bool; 64]
[src]

impl<Block: BlockType> Bits for [Block; 128]
[src]

impl Bits for [bool; 128]
[src]

impl<Block: BlockType> Bits for [Block; 256]
[src]

impl Bits for [bool; 256]
[src]

impl<Block: BlockType> Bits for [Block; 512]
[src]

impl Bits for [bool; 512]
[src]

impl<Block: BlockType> Bits for [Block; 1024]
[src]

impl Bits for [bool; 1024]
[src]

impl<Block: BlockType> Bits for [Block; 2048]
[src]

impl Bits for [bool; 2048]
[src]

impl<Block: BlockType> Bits for [Block; 4096]
[src]

impl Bits for [bool; 4096]
[src]

impl<Block: BlockType> Bits for [Block; 8192]
[src]

impl Bits for [bool; 8192]
[src]

impl<Block: BlockType> Bits for [Block; 16384]
[src]

impl Bits for [bool; 16384]
[src]

impl<Block: BlockType> Bits for [Block; 32768]
[src]

impl Bits for [bool; 32768]
[src]

impl<Block: BlockType> Bits for [Block; 65536]
[src]

impl Bits for [bool; 65536]
[src]

impl<Block: BlockType> Bits for [Block; 131072]
[src]

impl Bits for [bool; 131072]
[src]

impl<Block: BlockType> Bits for [Block; 262144]
[src]

impl Bits for [bool; 262144]
[src]

impl<Block: BlockType> Bits for [Block; 524288]
[src]

impl Bits for [bool; 524288]
[src]

impl<Block: BlockType> Bits for [Block; 1048576]
[src]

impl Bits for [bool; 1048576]
[src]

impl Bits for u8
[src]

impl Bits for u16
[src]

impl Bits for u32
[src]

impl Bits for u64
[src]

impl Bits for u128
[src]

impl Bits for usize
[src]

Implementors