pub struct BitReader<'a> { /* private fields */ }Expand description
Borrowed bit reader over &[u8]. LSB-first within each byte.
Implementations§
Source§impl<'a> BitReader<'a>
impl<'a> BitReader<'a>
pub fn new(bytes: &'a [u8]) -> Self
Sourcepub fn bit_position(&self) -> u64
pub fn bit_position(&self) -> u64
Total bits consumed so far.
Sourcepub fn bytes_consumed(&self) -> usize
pub fn bytes_consumed(&self) -> usize
Bytes consumed so far, rounded up — useful for advancing an outer byte cursor past the bitstream.
Sourcepub fn read_bits(&mut self, n: u32) -> Result<u64>
pub fn read_bits(&mut self, n: u32) -> Result<u64>
Read n bits LSB-first as an unsigned integer in the low bits.
Sourcepub fn read_signed(&mut self, n: u32) -> Result<i64>
pub fn read_signed(&mut self, n: u32) -> Result<i64>
Read n bits and sign-extend (two’s complement). n must be ≤ 64.
Auto Trait Implementations§
impl<'a> Freeze for BitReader<'a>
impl<'a> RefUnwindSafe for BitReader<'a>
impl<'a> Send for BitReader<'a>
impl<'a> Sync for BitReader<'a>
impl<'a> Unpin for BitReader<'a>
impl<'a> UnsafeUnpin for BitReader<'a>
impl<'a> UnwindSafe for BitReader<'a>
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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