Trait flatcontainer::impls::codec::Codec

source ·
pub trait Codec: Default {
    // Required methods
    fn decode<'a>(&'a self, bytes: &'a [u8]) -> &'a [u8] ;
    fn encode<R>(&mut self, bytes: &[u8], output: &mut R) -> R::Index
       where for<'a> R: Region + Push<&'a [u8]>;
    fn new_from<'a, I: Iterator<Item = &'a Self> + Clone>(stats: I) -> Self
       where Self: 'a;
    fn heap_size<F: FnMut(usize, usize)>(&self, callback: F);

    // Provided method
    fn report(&self) { ... }
}
Expand description

Encode and decode byte strings.

Required Methods§

source

fn decode<'a>(&'a self, bytes: &'a [u8]) -> &'a [u8]

Decodes an input byte slice into a sequence of byte slices.

source

fn encode<R>(&mut self, bytes: &[u8], output: &mut R) -> R::Index
where for<'a> R: Region + Push<&'a [u8]>,

Encodes a sequence of byte slices into an output byte slice.

source

fn new_from<'a, I: Iterator<Item = &'a Self> + Clone>(stats: I) -> Self
where Self: 'a,

Constructs a new instance of Self from accumulated statistics. These statistics should cover the data the output expects to see.

source

fn heap_size<F: FnMut(usize, usize)>(&self, callback: F)

Heap size, size - capacity

Provided Methods§

source

fn report(&self)

Diagnostic information about the state of the codec.

Object Safety§

This trait is not object safe.

Implementors§