pub struct CountBitReader<E: Endianness, BR: BitRead<E>, const PRINT: bool = false> {
pub bits_read: usize,
/* private fields */
}
Expand description
A wrapper around a BitRead
that keeps track of the number of
bits read and optionally prints on standard error the operations performed on the stream.
Fields§
§bits_read: usize
The number of bits read (or skipped) so far from the underlying BitRead
.
Implementations§
Source§impl<E: Endianness, BR: BitRead<E>, const PRINT: bool> CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR: BitRead<E>, const PRINT: bool> CountBitReader<E, BR, PRINT>
pub fn new(bit_read: BR) -> Self
pub fn into_inner(self) -> BR
Trait Implementations§
Source§impl<E: Endianness, BR: BitRead<E>, const PRINT: bool> BitRead<E> for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR: BitRead<E>, const PRINT: bool> BitRead<E> for CountBitReader<E, BR, PRINT>
type Error = <BR as BitRead<E>>::Error
Source§type PeekWord = <BR as BitRead<E>>::PeekWord
type PeekWord = <BR as BitRead<E>>::PeekWord
The type we can read from the stream without advancing.
Source§fn read_bits(&mut self, n_bits: usize) -> Result<u64, Self::Error>
fn read_bits(&mut self, n_bits: usize) -> Result<u64, Self::Error>
Read
n
bits and return them in the lowest bits. Read moreSource§fn peek_bits(&mut self, n_bits: usize) -> Result<Self::PeekWord, Self::Error>
fn peek_bits(&mut self, n_bits: usize) -> Result<Self::PeekWord, Self::Error>
Peeks at
n
bits without advancing the stream position.
n
must be nonzero, and at most PeekWord::BITS
.Source§fn skip_bits(&mut self, n_bits: usize) -> Result<(), Self::Error>
fn skip_bits(&mut self, n_bits: usize) -> Result<(), Self::Error>
Skip
n
bits from the stream. Read morefn copy_to<F: Endianness, W: BitWrite<F>>( &mut self, bit_write: &mut W, n: u64, ) -> Result<(), CopyError<Self::Error, W::Error>>
Source§impl<E: Endianness, BR: BitRead<E> + BitSeek, const PRINT: bool> BitSeek for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR: BitRead<E> + BitSeek, const PRINT: bool> BitSeek for CountBitReader<E, BR, PRINT>
Source§impl<E: Clone + Endianness, BR: Clone + BitRead<E>, const PRINT: bool> Clone for CountBitReader<E, BR, PRINT>
impl<E: Clone + Endianness, BR: Clone + BitRead<E>, const PRINT: bool> Clone for CountBitReader<E, BR, PRINT>
Source§fn clone(&self) -> CountBitReader<E, BR, PRINT>
fn clone(&self) -> CountBitReader<E, BR, PRINT>
Returns a copy 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 moreSource§impl<E: Endianness, BR, const PRINT: bool> CopyType for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR, const PRINT: bool> CopyType for CountBitReader<E, BR, PRINT>
Source§impl<E: Debug + Endianness, BR: Debug + BitRead<E>, const PRINT: bool> Debug for CountBitReader<E, BR, PRINT>
impl<E: Debug + Endianness, BR: Debug + BitRead<E>, const PRINT: bool> Debug for CountBitReader<E, BR, PRINT>
Source§impl<E: Endianness, BR: BitRead<E> + DeltaRead<E>, const PRINT: bool> DeltaRead<E> for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR: BitRead<E> + DeltaRead<E>, const PRINT: bool> DeltaRead<E> for CountBitReader<E, BR, PRINT>
Source§impl<E: Endianness, BR: BitRead<E> + GammaRead<E>, const PRINT: bool> GammaRead<E> for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR: BitRead<E> + GammaRead<E>, const PRINT: bool> GammaRead<E> for CountBitReader<E, BR, PRINT>
Source§impl<E: Endianness, BR, const PRINT: bool> MemDbgImpl for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR, const PRINT: bool> MemDbgImpl for CountBitReader<E, BR, PRINT>
fn _mem_dbg_rec_on( &self, _memdbg_writer: &mut impl Write, _memdbg_total_size: usize, _memdbg_max_depth: usize, _memdbg_prefix: &mut String, _memdbg_is_last: bool, _memdbg_flags: DbgFlags, ) -> Result
fn _mem_dbg_depth_on( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, padded_size: usize, flags: DbgFlags, ) -> Result<(), Error>
Source§impl<E: Endianness, BR, const PRINT: bool> MemSize for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR, const PRINT: bool> MemSize for CountBitReader<E, BR, PRINT>
Auto Trait Implementations§
impl<E, BR, const PRINT: bool> Freeze for CountBitReader<E, BR, PRINT>where
BR: Freeze,
impl<E, BR, const PRINT: bool> RefUnwindSafe for CountBitReader<E, BR, PRINT>where
BR: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, BR, const PRINT: bool> Send for CountBitReader<E, BR, PRINT>where
BR: Send,
impl<E, BR, const PRINT: bool> Sync for CountBitReader<E, BR, PRINT>where
BR: Sync,
impl<E, BR, const PRINT: bool> Unpin for CountBitReader<E, BR, PRINT>
impl<E, BR, const PRINT: bool> UnwindSafe for CountBitReader<E, BR, PRINT>where
BR: UnwindSafe,
E: UnwindSafe,
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, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<B> DeltaReadParam<BigEndian> for Bwhere
B: GammaReadParam<BigEndian>,
impl<B> DeltaReadParam<BigEndian> for Bwhere
B: GammaReadParam<BigEndian>,
Source§impl<B> DeltaReadParam<LittleEndian> for Bwhere
B: GammaReadParam<LittleEndian>,
impl<B> DeltaReadParam<LittleEndian> for Bwhere
B: GammaReadParam<LittleEndian>,
fn read_delta_param<const USE_DELTA_TABLE: bool, const USE_GAMMA_TABLE: bool>( &mut self, ) -> Result<u64, <B as BitRead<LittleEndian>>::Error>
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Truncate the current UnsignedInt to a possibly smaller size
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<E, B> ExpGolombRead<E> for B
impl<E, B> ExpGolombRead<E> for B
Source§impl<B> GammaReadParam<BigEndian> for B
impl<B> GammaReadParam<BigEndian> for B
Source§impl<B> GammaReadParam<LittleEndian> for Bwhere
B: BitRead<LittleEndian>,
impl<B> GammaReadParam<LittleEndian> for Bwhere
B: BitRead<LittleEndian>,
fn read_gamma_param<const USE_TABLE: bool>( &mut self, ) -> Result<u64, <B as BitRead<LittleEndian>>::Error>
Source§impl<E, B> GolombRead<E> for Bwhere
E: Endianness,
B: BitRead<E>,
impl<E, B> GolombRead<E> for Bwhere
E: Endianness,
B: BitRead<E>,
Source§impl<T> MemDbg for Twhere
T: MemDbgImpl,
impl<T> MemDbg for Twhere
T: MemDbgImpl,
Source§fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
Writes to stderr debug infos about the structure memory usage, expanding
all levels of nested structures.
Source§fn mem_dbg_on(
&self,
writer: &mut impl Write,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags, ) -> Result<(), Error>
Writes to a
core::fmt::Write
debug infos about the structure memory
usage, expanding all levels of nested structures.Source§fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
Writes to stderr debug infos about the structure memory usage as
mem_dbg
, but expanding only up to max_depth
levels of nested structures.Source§fn mem_dbg_depth_on(
&self,
writer: &mut impl Write,
max_depth: usize,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_depth_on( &self, writer: &mut impl Write, max_depth: usize, flags: DbgFlags, ) -> Result<(), Error>
Writes to a
core::fmt::Write
debug infos about the structure memory
usage as mem_dbg_on
, but expanding only up to
max_depth
levels of nested structures.Source§impl<E, B> MinimalBinaryRead<E> for Bwhere
E: Endianness,
B: BitRead<E>,
impl<E, B> MinimalBinaryRead<E> for Bwhere
E: Endianness,
B: BitRead<E>,
Source§impl<E, B> OmegaRead<E> for Bwhere
E: Endianness,
B: BitRead<E>,
impl<E, B> OmegaRead<E> for Bwhere
E: Endianness,
B: BitRead<E>,
Source§impl<E, B> RiceRead<E> for Bwhere
E: Endianness,
B: BitRead<E>,
impl<E, B> RiceRead<E> for Bwhere
E: Endianness,
B: BitRead<E>,
Source§impl<T> UpcastableFrom<T> for T
impl<T> UpcastableFrom<T> for T
Source§fn upcast_from(value: T) -> T
fn upcast_from(value: T) -> T
Extend the current UnsignedInt to a possibly bigger size.