Trait bitstream_io::BitQueue
[−]
[src]
pub trait BitQueue<N: Numeric> { fn set(&mut self, value: N, bits: u32); fn value(self) -> N; fn len(&self) -> u32; fn push(&mut self, bits: u32, value: N); fn pop(&mut self, bits: u32) -> N; fn is_empty(&self) -> bool { ... } fn clear(&mut self) { ... } }
This trait is for treating numeric types as a queue of bits which values can be pushed to and popped from in order to implement bitstream readers and writers.
Required Methods
fn set(&mut self, value: N, bits: u32)
Discards queue's current status and sets it to new bits and value
fn value(self) -> N
Consumes queue and returns its internal value
fn len(&self) -> u32
Current length of queue, in bits
fn push(&mut self, bits: u32, value: N)
Pushes a new value onto the back of the queue using the given number of bits. May panic if the total number of bits exceeds the size of the type being pushed onto.
fn pop(&mut self, bits: u32) -> N
Pops a value from the front of the queue with the given number of bits. Returns queue's whole contents if the requested number of bits exceeds the size of the queue.
Provided Methods
fn is_empty(&self) -> bool
Whether or not the queue is empty
fn clear(&mut self)
Discards queue's current status and sets bits and value to 0
Implementors
impl<N: Numeric> BitQueue<N> for BitQueueBE<N>
impl<N: Numeric> BitQueue<N> for BitQueueLE<N>