Trait BitsMut

Source
pub trait BitsMut: Bits {
    // Provided methods
    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) { ... }
}
Expand description

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§

Source

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

Sets the bit at position to value.

The default implementation uses get_raw_block and set_block.

§Panics

Panics if position is out of bounds.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<Block: BlockType> Bits for Box<dyn BitsMut<Block = Block>>

Source§

type Block = Block

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

fn bit_len(&self) -> u64

The length of the slice in bits.
Source§

fn block_len(&self) -> usize

The length of the slice in blocks.
Source§

fn get_bit(&self, position: u64) -> bool

Gets the bit at position Read more
Source§

fn get_block(&self, position: usize) -> Self::Block

Gets the block at position, masked as necessary. Read more
Source§

fn get_raw_block(&self, position: usize) -> Self::Block

Gets the block at position, without masking. Read more
Source§

fn get_bits(&self, start: u64, count: usize) -> Self::Block

Gets count bits starting at bit index start, interpreted as a little-endian integer. Read more
Source§

fn to_bit_vec(&self) -> BitVec<Self::Block>

Copies the bits into a new allocated BitVec.
Source§

impl<Block: BlockType> BitsMut for Box<dyn BitsMut<Block = Block>>

Source§

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

Sets the bit at position to value. Read more
Source§

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

Sets the block at position to value. Read more
Source§

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

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

Implementations on Foreign Types§

Source§

impl BitsMut for u8

Source§

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

Source§

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

Source§

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

Source§

impl BitsMut for u16

Source§

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

Source§

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

Source§

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

Source§

impl BitsMut for u32

Source§

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

Source§

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

Source§

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

Source§

impl BitsMut for u64

Source§

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

Source§

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

Source§

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

Source§

impl BitsMut for u128

Source§

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

Source§

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

Source§

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

Source§

impl BitsMut for usize

Source§

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

Source§

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

Source§

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

Source§

impl BitsMut for Vec<bool>

Source§

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

Source§

impl BitsMut for [bool; 0]

Source§

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

Source§

impl BitsMut for [bool; 1]

Source§

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

Source§

impl BitsMut for [bool; 2]

Source§

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

Source§

impl BitsMut for [bool; 3]

Source§

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

Source§

impl BitsMut for [bool; 4]

Source§

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

Source§

impl BitsMut for [bool; 5]

Source§

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

Source§

impl BitsMut for [bool; 6]

Source§

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

Source§

impl BitsMut for [bool; 7]

Source§

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

Source§

impl BitsMut for [bool; 8]

Source§

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

Source§

impl BitsMut for [bool; 9]

Source§

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

Source§

impl BitsMut for [bool; 10]

Source§

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

Source§

impl BitsMut for [bool; 11]

Source§

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

Source§

impl BitsMut for [bool; 12]

Source§

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

Source§

impl BitsMut for [bool; 13]

Source§

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

Source§

impl BitsMut for [bool; 14]

Source§

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

Source§

impl BitsMut for [bool; 15]

Source§

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

Source§

impl BitsMut for [bool; 16]

Source§

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

Source§

impl BitsMut for [bool; 17]

Source§

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

Source§

impl BitsMut for [bool; 18]

Source§

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

Source§

impl BitsMut for [bool; 19]

Source§

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

Source§

impl BitsMut for [bool; 20]

Source§

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

Source§

impl BitsMut for [bool; 21]

Source§

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

Source§

impl BitsMut for [bool; 22]

Source§

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

Source§

impl BitsMut for [bool; 23]

Source§

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

Source§

impl BitsMut for [bool; 24]

Source§

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

Source§

impl BitsMut for [bool; 25]

Source§

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

Source§

impl BitsMut for [bool; 26]

Source§

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

Source§

impl BitsMut for [bool; 27]

Source§

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

Source§

impl BitsMut for [bool; 28]

Source§

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

Source§

impl BitsMut for [bool; 29]

Source§

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

Source§

impl BitsMut for [bool; 30]

Source§

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

Source§

impl BitsMut for [bool; 31]

Source§

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

Source§

impl BitsMut for [bool; 32]

Source§

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

Source§

impl BitsMut for [bool; 64]

Source§

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

Source§

impl BitsMut for [bool; 128]

Source§

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

Source§

impl BitsMut for [bool; 256]

Source§

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

Source§

impl BitsMut for [bool; 512]

Source§

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

Source§

impl BitsMut for [bool; 1024]

Source§

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

Source§

impl BitsMut for [bool; 2048]

Source§

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

Source§

impl BitsMut for [bool; 4096]

Source§

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

Source§

impl BitsMut for [bool; 8192]

Source§

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

Source§

impl BitsMut for [bool; 16384]

Source§

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

Source§

impl BitsMut for [bool; 32768]

Source§

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

Source§

impl BitsMut for [bool; 65536]

Source§

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

Source§

impl BitsMut for [bool; 131072]

Source§

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

Source§

impl BitsMut for [bool; 262144]

Source§

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

Source§

impl BitsMut for [bool; 524288]

Source§

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

Source§

impl BitsMut for [bool; 1048576]

Source§

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

Source§

impl BitsMut for [bool]

Source§

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

Source§

impl<'a, T: BitsMut + ?Sized> BitsMut for &'a mut T

Source§

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

Source§

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

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 0]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 1]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 2]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 3]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 4]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 5]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 6]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 7]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 8]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 9]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 10]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 11]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 12]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 13]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 14]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 15]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 16]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 17]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 18]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 19]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 20]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 21]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 22]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 23]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 24]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 25]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 26]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 27]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 28]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 29]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 30]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 31]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 32]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 64]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 128]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 256]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 512]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 1024]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 2048]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 4096]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 8192]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 16384]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 32768]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 65536]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 131072]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 262144]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 524288]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block; 1048576]

Source§

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

Source§

impl<Block: BlockType> BitsMut for [Block]

Source§

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

Source§

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

Source§

impl<Block: BlockType> BitsMut for Box<dyn BitsMut<Block = Block>>

Source§

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

Source§

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

Source§

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

Source§

impl<Block: BlockType> BitsMut for Vec<Block>

Source§

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

Source§

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

Implementors§

Source§

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

Source§

impl<'a, Block: BlockType> BitsMut for BoolAdapter<Block, &'a mut [bool]>

Source§

impl<'a, Block: BlockType> BitsMut for BitSliceMut<'a, Block>

Source§

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

Source§

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

Source§

impl<T: BitsMut> BitsMut for BitSliceAdapter<T>