Trait BitsPush

Source
pub trait BitsPush: BitsMut {
    // Required methods
    fn push_bit(&mut self, value: bool);
    fn pop_bit(&mut self) -> Option<bool>;

    // Provided methods
    fn align_block(&mut self, value: bool) { ... }
    fn push_block(&mut self, value: Self::Block) { ... }
}
Expand description

Bit vector operations that change the length.

Required Methods§

Source

fn push_bit(&mut self, value: bool)

Adds the given bit to the end of the bit vector.

Source

fn pop_bit(&mut self) -> Option<bool>

Removes and returns the last bit, if any.

Provided Methods§

Source

fn align_block(&mut self, value: bool)

Pushes value 0 or more times until the size of the bit vector is block-aligned.

Source

fn push_block(&mut self, value: Self::Block)

Pushes the given block onto the end of the bit vector.

If the end of the bit vector is not currently block-aligned, it pads with 0s up to the next block before pushing.

The default implementation pushes the block one bit at a time; override it with something more efficient.

Implementations on Foreign Types§

Source§

impl BitsPush for Vec<bool>

Source§

fn push_bit(&mut self, value: bool)

Source§

fn pop_bit(&mut self) -> Option<bool>

Implementors§

Source§

impl<'a, Block: BlockType> BitsPush for BoolAdapter<Block, &'a mut Vec<bool>>

Source§

impl<Block: BlockType> BitsPush for BoolAdapter<Block, Vec<bool>>

Source§

impl<Block: BlockType> BitsPush for BitVec<Block>