[−][src]Struct bitstream_io::BitQueue
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]
pub fn new() -> BitQueue<E, N>
[src]
Returns a new empty queue
pub fn from_value(value: N, bits: u32) -> BitQueue<E, N>
[src]
Creates a new queue from the given value with the given size Panics if the value is larger than the given number of bits.
pub fn set(&mut self, value: N, bits: u32)
[src]
Sets the queue to a given value with the given number of bits Panics if the value is larger than the given number of bits
pub fn value(self) -> N
[src]
Consumes the queue and returns its current value
pub fn len(&self) -> u32
[src]
Returns the total bits in the queue
pub fn max_len(&self) -> u32
[src]
Returns the maximum bits the queue can hold
pub fn remaining_len(&self) -> u32
[src]
Returns the remaining bits the queue can hold
pub fn is_empty(&self) -> bool
[src]
Returns true if the queue is empty
pub fn is_full(&self) -> bool
[src]
Returns true if the queue is full
pub fn clear(&mut self)
[src]
Drops all values in the queue
pub fn all_0(&self) -> bool
[src]
Returns true if all bits remaining in the queue are 0
pub fn all_1(&self) -> bool
[src]
Returns true if all bits remaining in the queue are 1
pub fn push(&mut self, bits: u32, value: N)
[src]
Pushes a value with the given number of bits onto the tail of the queue Panics if the number of bits pushed is larger than the queue can hold.
pub fn pop(&mut self, bits: u32) -> N
[src]
Pops a value with the given number of bits from the head of the queue Panics if the number of bits popped is larger than the number of bits in the queue.
pub fn pop_all(&mut self) -> N
[src]
Pops all the current bits from the queue and resets it to an empty state.
pub fn drop(&mut self, bits: u32)
[src]
Drops the given number of bits from the head of the queue without returning them. Panics if the number of bits dropped is larger than the number of bits in the queue.
pub fn pop_0(&mut self) -> u32
[src]
Pops all 0 bits up to and including the next 1 bit and returns the amount of 0 bits popped
pub fn pop_1(&mut self) -> u32
[src]
Pops all 1 bits up to and including the next 0 bit and returns the amount of 1 bits popped
impl<E: Endianness> BitQueue<E, u8>
[src]
pub fn to_state(&self) -> usize
[src]
Returns the state of the queue as a single value which can be used to perform lookups.
Auto Trait Implementations
impl<E, N> Sync for BitQueue<E, N> where
E: Sync,
N: Sync,
E: Sync,
N: Sync,
impl<E, N> Send for BitQueue<E, N> where
E: Send,
N: Send,
E: Send,
N: Send,
impl<E, N> Unpin for BitQueue<E, N> where
E: Unpin,
N: Unpin,
E: Unpin,
N: Unpin,
impl<E, N> RefUnwindSafe for BitQueue<E, N> where
E: RefUnwindSafe,
N: RefUnwindSafe,
E: RefUnwindSafe,
N: RefUnwindSafe,
impl<E, N> UnwindSafe for BitQueue<E, N> where
E: UnwindSafe,
N: UnwindSafe,
E: UnwindSafe,
N: UnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,