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: usizeThe 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 const fn new(bit_read: BR) -> Self
Sourcepub fn into_inner(self) -> BR
pub fn into_inner(self) -> BR
Consumes this reader and returns the underlying BitRead.
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>
Source§const PEEK_BITS: usize = BR::PEEK_BITS
const PEEK_BITS: usize = BR::PEEK_BITS
The number of bits that
peek_bits is guaranteed
to return successfully (with zero-extended EOF).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, num_bits: usize) -> Result<u64, Self::Error>
fn read_bits(&mut self, num_bits: usize) -> Result<u64, Self::Error>
Reads
num_bits bits and returns 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 Self::PeekWord::BITS.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 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 moreSource§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, const PRINT: bool> FlatType for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR, const PRINT: bool> FlatType 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>where
BR: MemDbgImpl + FlatType + BitRead<E>,
usize: MemDbgImpl + FlatType,
PhantomData<E>: MemDbgImpl + FlatType,
impl<E: Endianness, BR, const PRINT: bool> MemDbgImpl for CountBitReader<E, BR, PRINT>where
BR: MemDbgImpl + FlatType + BitRead<E>,
usize: MemDbgImpl + FlatType,
PhantomData<E>: MemDbgImpl + FlatType,
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, _memdbg_refs: &mut HashSet<usize>, ) -> 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, dbg_refs: &mut HashSet<usize>, ) -> Result<(), Error>
Source§fn _mem_dbg_depth_on_impl(
&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,
dbg_refs: &mut HashSet<usize>,
ref_display: RefDisplay,
) -> Result<(), Error>
fn _mem_dbg_depth_on_impl( &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, dbg_refs: &mut HashSet<usize>, ref_display: RefDisplay, ) -> Result<(), Error>
Internal implementation for depth display. Read more
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>
Source§impl<E: Endianness, BR: BitRead<E> + OmegaRead<E>, const PRINT: bool> OmegaRead<E> for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR: BitRead<E> + OmegaRead<E>, const PRINT: bool> OmegaRead<E> for CountBitReader<E, BR, PRINT>
Source§impl<E: Endianness, BR: BitRead<E> + PiRead<E>, const PRINT: bool> PiRead<E> for CountBitReader<E, BR, PRINT>
impl<E: Endianness, BR: BitRead<E> + PiRead<E>, const PRINT: bool> PiRead<E> 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> UnsafeUnpin for CountBitReader<E, BR, PRINT>where
BR: UnsafeUnpin,
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> 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<E, B> ExpGolombRead<E> for Bwhere
E: Endianness,
B: GammaRead<E>,
impl<E, B> ExpGolombRead<E> for Bwhere
E: Endianness,
B: GammaRead<E>,
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 info 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 info 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 info 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 info about the structure memory
usage as mem_dbg_on, but expanding only up to
max_depth levels of nested structures.