timely_container::flatcontainer::impls::codec

Trait 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 as Region>::Index
       where R: for<'a> Region + for<'a> Push<&'a [u8]>;
    fn new_from<'a, I>(stats: I) -> Self
       where I: Iterator<Item = &'a Self> + Clone,
             Self: 'a;
    fn heap_size<F>(&self, callback: F)
       where F: FnMut(usize, usize);

    // 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 as Region>::Index
where R: for<'a> Region + for<'a> Push<&'a [u8]>,

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

Source

fn new_from<'a, I>(stats: I) -> Self
where I: Iterator<Item = &'a Self> + Clone, 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>(&self, callback: F)
where F: FnMut(usize, usize),

Heap size, size - capacity

Provided Methods§

Source

fn report(&self)

Diagnostic information about the state of the codec.

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§