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>

source

pub fn new(bit_write: BW) -> Self

Trait Implementations§

source§

impl<E: Endianness, BR: BitWrite<E> + BitSeek, const PRINT: bool> BitSeek for CountBitWriter<E, BR, PRINT>

§

type Error = <BR as BitSeek>::Error

source§

fn get_bit_pos(&mut self) -> Result<u64, Self::Error>

Get the current position in bits from the start of the file.
source§

fn set_bit_pos(&mut self, bit_pos: u64) -> Result<(), Self::Error>

Set the current position in bits from the start of the file to bit_pos.
source§

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>

Write the lowest n bits of value to the stream and return the number of bits written, that is, n. Read more
source§

fn write_unary_param<const USE_TABLE: bool>( &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. Read more
source§

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. Read more
source§

fn flush(self) -> Result<(), Self::Error>

Flush the buffer, consuming the bit stream.
source§

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>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<E: Debug + Endianness, BW: Debug + BitWrite<E>, const PRINT: bool> Debug for CountBitWriter<E, BW, PRINT>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<E: Endianness, BW: BitWrite<E> + DeltaWrite<E>, const PRINT: bool> DeltaWrite<E> for CountBitWriter<E, BW, PRINT>

source§

fn write_delta(&mut self, value: u64) -> Result<usize, BW::Error>

source§

impl<E: Endianness, BW: BitWrite<E> + GammaWrite<E>, const PRINT: bool> GammaWrite<E> for CountBitWriter<E, BW, PRINT>

source§

fn write_gamma(&mut self, value: u64) -> Result<usize, BW::Error>

source§

impl<E: Endianness, BW: BitWrite<E> + ZetaWrite<E>, const PRINT: bool> ZetaWrite<E> for CountBitWriter<E, BW, PRINT>

source§

fn write_zeta(&mut self, value: u64, k: u64) -> Result<usize, BW::Error>

source§

fn write_zeta3(&mut self, value: u64) -> Result<usize, BW::Error>

Auto Trait Implementations§

§

impl<E, BW, const PRINT: bool> RefUnwindSafe for CountBitWriter<E, BW, PRINT>

§

impl<E, BW, const PRINT: bool> Send for CountBitWriter<E, BW, PRINT>
where BW: Send, E: Send,

§

impl<E, BW, const PRINT: bool> Sync for CountBitWriter<E, BW, PRINT>
where BW: Sync, E: Sync,

§

impl<E, BW, const PRINT: bool> Unpin for CountBitWriter<E, BW, PRINT>
where BW: Unpin, E: Unpin,

§

impl<E, BW, const PRINT: bool> UnwindSafe for CountBitWriter<E, BW, PRINT>
where BW: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CastableFrom<T> for T

source§

fn cast_from(value: T) -> T

Call Self as W
source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

source§

fn cast(self) -> U

Call W::cast_from(self)
source§

impl<B> DeltaWriteParam<BigEndian> for B

source§

fn write_delta_param<const USE_DELTA_TABLE: bool, const USE_GAMMA_TABLE: bool>( &mut self, n: u64 ) -> Result<usize, <B as BitWrite<BigEndian>>::Error>

source§

impl<B> DeltaWriteParam<LittleEndian> for B

source§

fn write_delta_param<const USE_DELTA_TABLE: bool, const USE_GAMMA_TABLE: bool>( &mut self, n: u64 ) -> Result<usize, <B as BitWrite<LittleEndian>>::Error>

source§

impl<T> DowncastableFrom<T> for T

source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

source§

fn downcast(self) -> U

Call W::downcast_from(self)
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<B> GammaWriteParam<BigEndian> for B
where B: BitWrite<BigEndian>,

source§

fn write_gamma_param<const USE_TABLE: bool>( &mut self, n: u64 ) -> Result<usize, <B as BitWrite<BigEndian>>::Error>

source§

impl<B> GammaWriteParam<LittleEndian> for B

source§

fn write_gamma_param<const USE_TABLE: bool>( &mut self, n: u64 ) -> Result<usize, <B as BitWrite<LittleEndian>>::Error>

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<BO, B> MinimalBinaryWrite<BO> for B
where BO: Endianness, B: BitWrite<BO>,

source§

fn write_minimal_binary( &mut self, n: u64, max: u64 ) -> Result<usize, Self::Error>

source§

impl<T> Splat<T> for T

source§

fn splat(value: T) -> T

source§

impl<T> To<T> for T

source§

fn to(self) -> T

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UpcastableFrom<T> for T

source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

source§

fn upcast(self) -> U

Call W::upcast_from(self)
source§

impl<B> ZetaWriteParam<BigEndian> for B
where B: BitWrite<BigEndian>,

source§

fn write_zeta_param<const USE_TABLE: bool>( &mut self, n: u64, k: u64 ) -> Result<usize, <B as BitWrite<BigEndian>>::Error>

source§

fn write_zeta3_param<const USE_TABLE: bool>( &mut self, n: u64 ) -> Result<usize, <B as BitWrite<BigEndian>>::Error>

source§

impl<B> ZetaWriteParam<LittleEndian> for B

source§

fn write_zeta_param<const USE_TABLE: bool>( &mut self, n: u64, k: u64 ) -> Result<usize, <B as BitWrite<LittleEndian>>::Error>

source§

fn write_zeta3_param<const USE_TABLE: bool>( &mut self, n: u64 ) -> Result<usize, <B as BitWrite<LittleEndian>>::Error>