matrix_pickle

Trait Encode

Source
pub trait Encode {
    // Required method
    fn encode(&self, writer: &mut impl Write) -> Result<usize, EncodeError>;

    // Provided method
    fn encode_to_vec(&self) -> Result<Vec<u8>, EncodeError> { ... }
}
Expand description

A trait for encoding values into the matrix-pickle binary format.

Required Methods§

Source

fn encode(&self, writer: &mut impl Write) -> Result<usize, EncodeError>

Try to encode and write a value to the given writer, returning how many bytes were written.

Provided Methods§

Source

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

Try to encode a value into a new Vec.

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.

Implementations on Foreign Types§

Source§

impl Encode for bool

Source§

fn encode(&self, writer: &mut impl Write) -> Result<usize, EncodeError>

Source§

impl Encode for u8

Source§

fn encode(&self, writer: &mut impl Write) -> Result<usize, EncodeError>

Source§

impl Encode for u32

Source§

fn encode(&self, writer: &mut impl Write) -> Result<usize, EncodeError>

Source§

impl Encode for usize

Source§

fn encode(&self, writer: &mut impl Write) -> Result<usize, EncodeError>

Source§

impl<T: Encode> Encode for [T]

Source§

fn encode(&self, writer: &mut impl Write) -> Result<usize, EncodeError>

Source§

impl<const N: usize> Encode for [u8; N]

Source§

fn encode(&self, writer: &mut impl Write) -> Result<usize, EncodeError>

Implementors§