pub(super) trait FixedSizeEncoding: IsDefault {
type ByteArray;
// Required methods
fn from_bytes(b: &Self::ByteArray) -> Self;
fn write_to_bytes(self, b: &mut Self::ByteArray);
}
Expand description
Helper trait, for encoding to, and decoding from, a fixed number of bytes.
Used mainly for Lazy positions and lengths.
Unchecked invariant: Self::default()
should encode as [0; BYTE_LEN]
,
but this has no impact on safety.
Required Associated Types§
Required Methods§
fn from_bytes(b: &Self::ByteArray) -> Self
fn write_to_bytes(self, b: &mut Self::ByteArray)
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.