Trait Encode

Source
pub trait Encode {
    // Required method
    fn encode(&self) -> Result<Vec<u8>, EncodeError>;

    // Provided method
    fn into_encoded(self) -> Result<Vec<u8>, EncodeError>
       where Self: Sized { ... }
}
Expand description

A trait that allows for encoding a structure into a byte sequence.

Required Methods§

Source

fn encode(&self) -> Result<Vec<u8>, EncodeError>

Encodes a structure into a byte sequence.

Provided Methods§

Source

fn into_encoded(self) -> Result<Vec<u8>, EncodeError>
where Self: Sized,

Implementations on Foreign Types§

Source§

impl Encode for ()

Source§

impl Encode for String

Source§

impl Encode for Vec<u8>

Implementors§