pub trait BitCodec: BitDecode + BitEncode {
// Provided methods
fn decode_bytes<E>(bytes: &[u8], byte_order: E) -> Result<Self>
where E: Endianness { ... }
fn encode_bytes<E>(&self, byte_order: E) -> Result<Vec<u8>>
where E: Endianness { ... }
}
Expand description
A trait with helper functions for simple codecs
Provided Methods§
Sourcefn decode_bytes<E>(bytes: &[u8], byte_order: E) -> Result<Self>where
E: Endianness,
fn decode_bytes<E>(bytes: &[u8], byte_order: E) -> Result<Self>where
E: Endianness,
Parses a new value from its raw byte representation without context.
Sourcefn encode_bytes<E>(&self, byte_order: E) -> Result<Vec<u8>>where
E: Endianness,
fn encode_bytes<E>(&self, byte_order: E) -> Result<Vec<u8>>where
E: Endianness,
Gets the raw bytes of this type without context.
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.