Trait Encoder

Source
pub trait Encoder<Item, const N: usize> {
    type Error: From<EncodeError>;

    // Required method
    fn to_bytes(
        &mut self,
        item: Item,
        dst: &mut Vec<u8, N>,
    ) -> Result<(), Self::Error>;
}
Expand description

Encoder trait to encode runtime or compile time messages for diagnsotic applications into streamable bytes. Similar but adapted from the tokio_utils Encoder to be used within a no_std environment.

Required Associated Types§

Source

type Error: From<EncodeError>

The type of encoding errors.

Required Methods§

Source

fn to_bytes( &mut self, item: Item, dst: &mut Vec<u8, N>, ) -> Result<(), Self::Error>

Encodes a frame into the buffer provided.

Implementors§