pub struct CountBitWriter<E: Endianness, BW: BitWrite<E>, const PRINT: bool = false> {
pub bits_written: usize,
/* private fields */
}
Expand description
A wrapper around a BitWrite
that keeps track of the number of
bits written and optionally prints on standard error the operations performed on the stream.
Fields§
§bits_written: usize
The number of bits written so far on the underlying BitWrite
.
Implementations§
Source§impl<E: Endianness, BW: BitWrite<E>, const PRINT: bool> CountBitWriter<E, BW, PRINT>
impl<E: Endianness, BW: BitWrite<E>, const PRINT: bool> CountBitWriter<E, BW, PRINT>
pub fn new(bit_write: BW) -> Self
pub fn into_inner(self) -> BW
Trait Implementations§
Source§impl<E: Endianness, BR: BitWrite<E> + BitSeek, const PRINT: bool> BitSeek for CountBitWriter<E, BR, PRINT>
impl<E: Endianness, BR: BitWrite<E> + BitSeek, const PRINT: bool> BitSeek for CountBitWriter<E, BR, PRINT>
Source§impl<E: Endianness, BW: BitWrite<E>, const PRINT: bool> BitWrite<E> for CountBitWriter<E, BW, PRINT>
impl<E: Endianness, BW: BitWrite<E>, const PRINT: bool> BitWrite<E> for CountBitWriter<E, BW, PRINT>
type Error = <BW as BitWrite<E>>::Error
Source§fn write_bits(
&mut self,
value: u64,
n_bits: usize,
) -> Result<usize, Self::Error>
fn write_bits( &mut self, value: u64, n_bits: usize, ) -> Result<usize, Self::Error>
Write the lowest
n
bits of value
to the stream and return the number
of bits written, that is, n
. Read moreSource§fn write_unary(&mut self, value: u64) -> Result<usize, Self::Error>
fn write_unary(&mut self, value: u64) -> Result<usize, Self::Error>
Write
value
as a unary code to the stream and return the number of
bits written, that is, value
plus one.Source§fn flush(&mut self) -> Result<usize, Self::Error>
fn flush(&mut self) -> Result<usize, Self::Error>
Flush the buffer, consuming the bit stream. Read more
fn copy_from<F: Endianness, R: BitRead<F>>( &mut self, bit_read: &mut R, n: u64, ) -> Result<(), CopyError<R::Error, Self::Error>>
Source§impl<E: Clone + Endianness, BW: Clone + BitWrite<E>, const PRINT: bool> Clone for CountBitWriter<E, BW, PRINT>
impl<E: Clone + Endianness, BW: Clone + BitWrite<E>, const PRINT: bool> Clone for CountBitWriter<E, BW, PRINT>
Source§fn clone(&self) -> CountBitWriter<E, BW, PRINT>
fn clone(&self) -> CountBitWriter<E, BW, 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: Endianness, BW, const PRINT: bool> CopyType for CountBitWriter<E, BW, PRINT>
impl<E: Endianness, BW, const PRINT: bool> CopyType for CountBitWriter<E, BW, PRINT>
Source§impl<E: Debug + Endianness, BW: Debug + BitWrite<E>, const PRINT: bool> Debug for CountBitWriter<E, BW, PRINT>
impl<E: Debug + Endianness, BW: Debug + BitWrite<E>, const PRINT: bool> Debug for CountBitWriter<E, BW, PRINT>
Source§impl<E: Endianness, BW: BitWrite<E> + DeltaWrite<E>, const PRINT: bool> DeltaWrite<E> for CountBitWriter<E, BW, PRINT>
impl<E: Endianness, BW: BitWrite<E> + DeltaWrite<E>, const PRINT: bool> DeltaWrite<E> for CountBitWriter<E, BW, PRINT>
Source§impl<E: Endianness, BW: BitWrite<E> + GammaWrite<E>, const PRINT: bool> GammaWrite<E> for CountBitWriter<E, BW, PRINT>
impl<E: Endianness, BW: BitWrite<E> + GammaWrite<E>, const PRINT: bool> GammaWrite<E> for CountBitWriter<E, BW, PRINT>
Source§impl<E: Endianness, BW, const PRINT: bool> MemDbgImpl for CountBitWriter<E, BW, PRINT>
impl<E: Endianness, BW, const PRINT: bool> MemDbgImpl for CountBitWriter<E, BW, 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, BW, const PRINT: bool> MemSize for CountBitWriter<E, BW, PRINT>
impl<E: Endianness, BW, const PRINT: bool> MemSize for CountBitWriter<E, BW, PRINT>
Auto Trait Implementations§
impl<E, BW, const PRINT: bool> Freeze for CountBitWriter<E, BW, PRINT>where
BW: Freeze,
impl<E, BW, const PRINT: bool> RefUnwindSafe for CountBitWriter<E, BW, PRINT>where
BW: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, BW, const PRINT: bool> Send for CountBitWriter<E, BW, PRINT>where
BW: Send,
impl<E, BW, const PRINT: bool> Sync for CountBitWriter<E, BW, PRINT>where
BW: Sync,
impl<E, BW, const PRINT: bool> Unpin for CountBitWriter<E, BW, PRINT>
impl<E, BW, const PRINT: bool> UnwindSafe for CountBitWriter<E, BW, PRINT>where
BW: 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> DeltaWriteParam<BigEndian> for Bwhere
B: GammaWriteParam<BigEndian>,
impl<B> DeltaWriteParam<BigEndian> for Bwhere
B: GammaWriteParam<BigEndian>,
Source§impl<B> DeltaWriteParam<LittleEndian> for Bwhere
B: GammaWriteParam<LittleEndian>,
impl<B> DeltaWriteParam<LittleEndian> for Bwhere
B: GammaWriteParam<LittleEndian>,
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> ExpGolombWrite<E> for B
impl<E, B> ExpGolombWrite<E> for B
Source§impl<B> GammaWriteParam<BigEndian> for B
impl<B> GammaWriteParam<BigEndian> for B
Source§impl<B> GammaWriteParam<LittleEndian> for Bwhere
B: BitWrite<LittleEndian>,
impl<B> GammaWriteParam<LittleEndian> for Bwhere
B: BitWrite<LittleEndian>,
fn write_gamma_param<const USE_TABLE: bool>( &mut self, n: u64, ) -> Result<usize, <B as BitWrite<LittleEndian>>::Error>
Source§impl<E, B> GolombWrite<E> for Bwhere
E: Endianness,
B: BitWrite<E>,
impl<E, B> GolombWrite<E> for Bwhere
E: Endianness,
B: BitWrite<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> MinimalBinaryWrite<E> for Bwhere
E: Endianness,
B: BitWrite<E>,
impl<E, B> MinimalBinaryWrite<E> for Bwhere
E: Endianness,
B: BitWrite<E>,
Source§impl<E, B> OmegaWrite<E> for Bwhere
E: Endianness,
B: BitWrite<E>,
impl<E, B> OmegaWrite<E> for Bwhere
E: Endianness,
B: BitWrite<E>,
Source§impl<E, B> RiceWrite<E> for Bwhere
E: Endianness,
B: BitWrite<E>,
impl<E, B> RiceWrite<E> for Bwhere
E: Endianness,
B: BitWrite<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.