pub struct BitstreamReader { /* private fields */ }Expand description
Reads individual bits or multi-bit fields from a byte slice.
Bits are extracted MSB-first from each byte, matching the write order of
BitstreamWriter.
Implementations§
Source§impl BitstreamReader
impl BitstreamReader
Sourcepub fn read_bit(&mut self) -> Option<bool>
pub fn read_bit(&mut self) -> Option<bool>
Reads a single bit, returning None when the buffer is exhausted.
Sourcepub fn read_bits(&mut self, count: u8) -> Option<u64>
pub fn read_bits(&mut self, count: u8) -> Option<u64>
Reads count bits (MSB first) and assembles them into a u64.
Returns None if there are fewer than count bits remaining.
count must be in 1..=64.
Sourcepub fn read_byte(&mut self) -> Option<u8>
pub fn read_byte(&mut self) -> Option<u8>
Reads 8 bits and returns them as a u8.
Returns None when fewer than 8 bits remain.
Sourcepub fn bits_remaining(&self) -> usize
pub fn bits_remaining(&self) -> usize
Returns the number of bits remaining (bits not yet read).
Sourcepub fn is_exhausted(&self) -> bool
pub fn is_exhausted(&self) -> bool
Returns true when all bits have been consumed.
Trait Implementations§
Source§impl Clone for BitstreamReader
impl Clone for BitstreamReader
Source§fn clone(&self) -> BitstreamReader
fn clone(&self) -> BitstreamReader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BitstreamReader
impl RefUnwindSafe for BitstreamReader
impl Send for BitstreamReader
impl Sync for BitstreamReader
impl Unpin for BitstreamReader
impl UnsafeUnpin for BitstreamReader
impl UnwindSafe for BitstreamReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more