Struct bitstream_io::BitQueue
[−]
[src]
pub struct BitQueue<E: Endianness, N: Numeric> { /* fields omitted */ }
A queue for efficiently pushing bits onto a value and popping them off a value.
Methods
impl<E: Endianness, N: Numeric> BitQueue<E, N>
[src]
fn new() -> BitQueue<E, N>
Returns a new empty queue
fn from_value(value: N, bits: u32) -> BitQueue<E, N>
Creates a new queue from the given value with the given size
fn set(&mut self, value: N, bits: u32)
Sets the queue to a given value with the given number of bits
fn value(self) -> N
Consumes the queue and returns its current value
fn len(&self) -> u32
Returns the total bits in the queue
fn max_len(&self) -> u32
Returns the maximum bits the queue can hold
fn is_empty(&self) -> bool
Returns true if the queue is empty
fn is_full(&self) -> bool
Returns true if the queue is full
fn clear(&mut self)
Drops all values in the queue
fn all_0(&self) -> bool
Returns true if all bits remaining in the queue are 0
fn all_1(&self) -> bool
Returns true if all bits remaining in the queue are 1
fn push(&mut self, bits: u32, value: N)
Pushes a value with the given number of bits onto the tail of the queue
fn pop(&mut self, bits: u32) -> N
Pops a value with the given number of bits from the head of the queue
fn drop(&mut self, bits: u32)
Drops the given number of bits from the head of the queue without returning them.
fn pop_0(&mut self) -> u32
Pops all 0 bits up to and including the next 1 bit and returns the amount of 0 bits popped
fn pop_1(&mut self) -> u32
Pops all 1 bits up to and including the next 0 bit and returns the amount of 1 bits popped