ToBytes

Trait ToBytes 

Source
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§

Source

type OutputSize: ArrayLength<u8>

An associated type to represent the serialized form of the implementing type.

Required Methods§

Source

fn to_bytes(&self) -> GenericArray<u8, Self::OutputSize>

Types implementing this method are serializable

Provided Methods§

Source

fn size() -> usize

Returns the size (in bytes) of this type when serialized

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.

Implementors§

Source§

impl ToBytes for PkP256

Source§

impl ToBytes for PkP384

Source§

impl ToBytes for SharedSecretP256

We only need the x co-ordinate from the result (i.e. 32 bytes of a coordinate from an Affine Point.)

Source§

impl ToBytes for SharedSecretP384

We only need the x co-ordinate from the result (i.e. 48 bytes of a coordinate from an Affine Point.)

Source§

impl ToBytes for SkP256

Source§

impl ToBytes for SkP384