Struct succinct::stream::BitBuffer
[−]
[src]
pub struct BitBuffer<Inner = BitVec> { // some fields omitted }
A bit buffer can be used to read bits from or write bits to an underlying bit vector.
Methods
impl<Block: BlockType> BitBuffer<BitVec<Block>>
[src]
fn new() -> Self
Creates a new, empty bit buffer.
fn with_capacity(capacity: u64) -> Self
Creates a new, empty bit buffer with the given capacity (in bits) preallocated.
impl<Inner: Bits> BitBuffer<Inner>
[src]
fn from(input: Inner) -> Self
Creates a new bit buffer for reading from a bit vector.
fn append(vec: Inner) -> Self
Creates a new bit buffer for appending to a bit vector.
fn seek(&mut self, position: u64) -> Result<()>
Moves the position for the next read or write.
impl<Inner> BitBuffer<Inner>
[src]
fn into_inner(self) -> Inner
Returns the bit vector underlying the bit buffer.
fn inner(&self) -> &Inner
Gives access to the bit vector underlying the bit buffer.
fn position(&self) -> u64
The position in the bit buffer where the next read or write will occur.
Trait Implementations
impl<Inner: Debug> Debug for BitBuffer<Inner>
[src]
impl<Inner: Clone> Clone for BitBuffer<Inner>
[src]
fn clone(&self) -> BitBuffer<Inner>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<Inner: Bits> Bits for BitBuffer<Inner>
[src]
type Block = Inner::Block
The underlying block type used to store the bits of the slice.
fn block_len(&self) -> usize
The length of the slice in blocks.
fn bit_len(&self) -> u64
The length of the slice in bits.
fn get_block(&self, position: usize) -> Self::Block
Gets the block at position
Read more
fn get_bit(&self, position: u64) -> bool
Gets the bit at position
Read more
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
impl<Inner: BitsMut> BitsMut for BitBuffer<Inner>
[src]
fn set_block(&mut self, position: usize, value: Self::Block)
Sets the block at position
to value
. Read more
fn set_bit(&mut self, position: u64, value: bool)
Sets the bit at position
to value
. Read more
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. Read more
impl<Inner: Bits> BitRead for BitBuffer<Inner>
[src]
fn read_bit(&mut self) -> Result<Option<bool>>
Reads a single bit from the source. Read more
fn read_int<N: PrimInt>(&mut self, nbits: usize) -> Result<N>
Reads nbits
bits as an integer, least-significant bit first.
fn read_int_be<N: PrimInt>(&mut self, nbits: usize) -> Result<N>
Reads nbits
bits as an integer, most-significant bit first.
impl<Inner: BitVector> BitWrite for BitBuffer<Inner>
[src]
fn write_bit(&mut self, value: bool) -> Result<()>
Writes a single bit to the sink.
fn write_int<N: PrimInt>(&mut self, nbits: usize, value: N) -> Result<()>
Writes the lower nbits
of value
, least-significant first.
fn write_int_be<N: PrimInt>(&mut self, nbits: usize, value: N) -> Result<()>
Writes the lower nbits
of value
, most-significant first.