Encode

Trait Encode 

Source
pub trait Encode {
    // Required method
    fn encode_slice<T: AsRef<[u8]>>(
        &self,
        input: T,
        output: &mut [u8],
    ) -> Result<usize, EscnulError>;

    // Provided method
    fn encode<T: AsRef<[u8]>>(&self, input: T) -> Vec<u8>  { ... }
}
Expand description

Trait for encoding a byte stream into a pre-allocated output buffer.

Required Methods§

Source

fn encode_slice<T: AsRef<[u8]>>( &self, input: T, output: &mut [u8], ) -> Result<usize, EscnulError>

Encode input into output, returning the number of bytes written.

§Errors

Provided Methods§

Source

fn encode<T: AsRef<[u8]>>(&self, input: T) -> Vec<u8>

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§