Trait matrix_pickle::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.

Object Safety§

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§