Trait dsi_bitstream::traits::BitWrite
source · pub trait BitWrite<E: Endianness> {
type Error: Error + Send + Sync + 'static;
// Required methods
fn write_bits(&mut self, value: u64, n: usize) -> Result<usize, Self::Error>;
fn write_unary(&mut self, value: u64) -> Result<usize, Self::Error>;
fn flush(&mut self) -> Result<(), Self::Error>;
// Provided method
fn copy_from<F: Endianness>(
&mut self,
bit_read: &mut impl BitRead<F>,
n: u64
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> { ... }
}
Expand description
Sequential, streaming bit-by-bit writes.
This trait specify basic operation over which codes can be implemented
by traits such as crate::codes::GammaWriteParam
.
Required Associated Types§
Required Methods§
sourcefn write_bits(&mut self, value: u64, n: usize) -> Result<usize, Self::Error>
fn write_bits(&mut self, value: u64, n: 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
.
Implementors should check the value of n
in test mode and panic if it
is greater than 64. Moreover, if the feature checks
is enabled they
should check that the remaining bits of value
are zero.
Provided Methods§
fn copy_from<F: Endianness>( &mut self, bit_read: &mut impl BitRead<F>, n: u64 ) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
Object Safety§
This trait is not object safe.