Trait BoxedSliceEncodable

Source
pub trait BoxedSliceEncodable: CompactEncoding {
    // Required method
    fn boxed_slice_encoded_size(
        boxed: &Box<[Self]>,
    ) -> Result<usize, EncodingError>
       where Self: Sized;

    // Provided methods
    fn boxed_slice_encode<'a>(
        vec: &Box<[Self]>,
        buffer: &'a mut [u8],
    ) -> Result<&'a mut [u8], EncodingError>
       where Self: Sized { ... }
    fn boxed_slice_decode(
        buffer: &[u8],
    ) -> Result<(Box<[Self]>, &[u8]), EncodingError>
       where Self: Sized { ... }
}
Expand description

Define this trait for T to get impl Box<[T]> for CompactEncoding

Required Methods§

Source

fn boxed_slice_encoded_size(boxed: &Box<[Self]>) -> Result<usize, EncodingError>
where Self: Sized,

The encoded size in bytes

Provided Methods§

Source

fn boxed_slice_encode<'a>( vec: &Box<[Self]>, buffer: &'a mut [u8], ) -> Result<&'a mut [u8], EncodingError>
where Self: Sized,

Encode Box<[Self]> to the buffer and return the remainder of the buffer

Source

fn boxed_slice_decode( buffer: &[u8], ) -> Result<(Box<[Self]>, &[u8]), EncodingError>
where Self: Sized,

Decode [Box<[Self]>] from buffer

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 BoxedSliceEncodable for u8

Source§

fn boxed_slice_encoded_size(boxed: &Box<[Self]>) -> Result<usize, EncodingError>
where Self: Sized,

Source§

fn boxed_slice_encode<'a>( boxed: &Box<[Self]>, buffer: &'a mut [u8], ) -> Result<&'a mut [u8], EncodingError>
where Self: Sized,

Source§

fn boxed_slice_decode( buffer: &[u8], ) -> Result<(Box<[Self]>, &[u8]), EncodingError>
where Self: Sized,

Implementors§