Trait succinct::BitsMut [] [src]

pub trait BitsMut: Bits {
    fn set_bit(&mut self, position: u64, value: bool) { ... }
    fn set_block(&mut self, position: usize, value: Self::Block) { ... }
    fn set_bits(&mut self, start: u64, count: usize, value: Self::Block) { ... }
}

Interface for mutable bit vector operations that don’t affect the length.

Minimal complete definition is set_bit or set_block, since each is defined in terms of the other. Note that set_block in terms of set_bit is inefficient, and thus you should implement set_block directly if possible.

Provided Methods

fn set_bit(&mut self, position: u64, value: bool)

Sets the bit at position to value.

The default implementation uses get_block and set_block.

Panics

Panics if position is out of bounds.

fn set_block(&mut self, position: usize, value: Self::Block)

Sets the block at position to value.

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 bits that are not part of the bit vector. Implementations of set_block should not change those trailing bits.

The default implementation sets a block by setting each of its bits in turn. Consider it a slow reference implementation, and override it.

Panics

Panics if position is out of bounds.

fn set_bits(&mut self, start: u64, count: usize, value: Self::Block)

Sets count bits starting at bit index start, interpreted as a little-endian integer.

Panics

Panics if the bit span goes out of bounds.

Implementors