pub trait FixedWidthEncoding {
type Decode;
// Required methods
fn fw_encoded_size(&self) -> Result<usize, EncodingError>;
fn fw_encode<'a>(
&self,
buffer: &'a mut [u8],
) -> Result<&'a mut [u8], EncodingError>;
fn fw_decode(buffer: &[u8]) -> Result<(Self::Decode, &[u8]), EncodingError>
where Self: Sized;
// Provided method
fn as_fixed_width(&self) -> FixedWidthUint<'_, Self> { ... }
}
Expand description
Implents functionality needed to encode unisegned integrer in a fixed width way with
CompactEncoding
Required Associated Types§
Required Methods§
Sourcefn fw_encoded_size(&self) -> Result<usize, EncodingError>
fn fw_encoded_size(&self) -> Result<usize, EncodingError>
The size in bytes required to encode self
.
Provided Methods§
Sourcefn as_fixed_width(&self) -> FixedWidthUint<'_, Self>
fn as_fixed_width(&self) -> FixedWidthUint<'_, Self>
Get a uint in a form that encodes to a fixed width
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.