Struct dsi_bitstream::utils::CountBitReader
source · 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>
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
§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>
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
E: Endianness + 'static,
BR: Freeze,
impl<E, BR, const PRINT: bool> RefUnwindSafe for CountBitReader<E, BR, PRINT>where
E: Endianness + 'static + RefUnwindSafe,
BR: RefUnwindSafe,
impl<E, BR, const PRINT: bool> Send for CountBitReader<E, BR, PRINT>
impl<E, BR, const PRINT: bool> Sync for CountBitReader<E, BR, PRINT>
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
E: Endianness + 'static + UnwindSafe,
BR: 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<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>
Write to stdout 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>
Write to a
core::fmt::Write
debug infos about the structure memory usage,
expanding all levels of nested structures.source§fn mem_dbg_depth(
&self,
total_size: usize,
max_depth: usize,
flags: DbgFlags
) -> Result<(), Error>
fn mem_dbg_depth( &self, total_size: usize, max_depth: usize, flags: DbgFlags ) -> Result<(), Error>
Write to stdout debug infos about the structure memory usage, but expanding only
up to
max_depth
levels of nested structures.source§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,
flags: DbgFlags
) -> Result<(), Error>
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, flags: DbgFlags ) -> Result<(), Error>
Write to a
core::fmt::Write
debug infos about the structure memory usage,
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> 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.