Trait flatcontainer::impls::codec::Codec
source · pub trait Codec: Default + 'static {
// Required methods
fn decode<'a>(&'a self, bytes: &'a [u8]) -> &'a [u8] ⓘ;
fn encode<R: Region>(&mut self, bytes: &[u8], output: &mut R) -> R::Index
where for<'a> &'a [u8]: CopyOnto<R>;
fn new_from<'a, I: Iterator<Item = &'a Self> + Clone>(stats: I) -> Self;
fn heap_size<F: FnMut(usize, usize)>(&self, callback: F);
// Provided method
fn report(&self) { ... }
}
Expand description
Encode and decode byte strings.
Required Methods§
sourcefn decode<'a>(&'a self, bytes: &'a [u8]) -> &'a [u8] ⓘ
fn decode<'a>(&'a self, bytes: &'a [u8]) -> &'a [u8] ⓘ
Decodes an input byte slice into a sequence of byte slices.
sourcefn encode<R: Region>(&mut self, bytes: &[u8], output: &mut R) -> R::Index
fn encode<R: Region>(&mut self, bytes: &[u8], output: &mut R) -> R::Index
Encodes a sequence of byte slices into an output byte slice.
Provided Methods§
Object Safety§
This trait is not object safe.