pub trait ToBytes {
type OutputSize: ArrayLength<u8>;
// Required method
fn to_bytes(&self) -> GenericArray<u8, Self::OutputSize>;
// Provided method
fn size() -> usize { ... }
}Expand description
Implemented by types that have a fixed-length byte representation
Required Associated Types§
Sourcetype OutputSize: ArrayLength<u8>
type OutputSize: ArrayLength<u8>
An associated type to represent the serialized form of the implementing type.
Required Methods§
Sourcefn to_bytes(&self) -> GenericArray<u8, Self::OutputSize>
fn to_bytes(&self) -> GenericArray<u8, Self::OutputSize>
Types implementing this method are serializable
Provided Methods§
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.