pub trait AbstractBits {
const MIN_BITS: usize;
const MAX_BITS: usize;
// Required methods
fn write_abstract_bits(
&self,
writer: &mut BitWriter<'_>,
) -> Result<(), ToBytesError>;
fn read_abstract_bits(
reader: &mut BitReader<'_>,
) -> Result<Self, FromBytesError>
where Self: Sized;
// Provided methods
fn to_abstract_bits(&self) -> Result<Vec<u8>, ToBytesError> { ... }
fn from_abstract_bits(bytes: &[u8]) -> Result<Self, FromBytesError>
where Self: Sized { ... }
}Required Associated Constants§
Required Methods§
Sourcefn write_abstract_bits(
&self,
writer: &mut BitWriter<'_>,
) -> Result<(), ToBytesError>
fn write_abstract_bits( &self, writer: &mut BitWriter<'_>, ) -> Result<(), ToBytesError>
To get the amount written use BitWriter::bits_written
or BitWriter::bytes_written
Sourcefn read_abstract_bits(
reader: &mut BitReader<'_>,
) -> Result<Self, FromBytesError>where
Self: Sized,
fn read_abstract_bits(
reader: &mut BitReader<'_>,
) -> Result<Self, FromBytesError>where
Self: Sized,
To get the amount read use BitReader::bits_read
or BitReader::bytes_read
Provided Methods§
fn to_abstract_bits(&self) -> Result<Vec<u8>, ToBytesError>
fn from_abstract_bits(bytes: &[u8]) -> Result<Self, FromBytesError>where
Self: Sized,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.