pub trait Serializer {
    // Required methods
    fn serialize_into_writer<W>(treemap: &Treemap, dst: W) -> Result<usize>
       where W: Write;
    fn serialize_into<'a>(treemap: &Treemap, dst: &'a mut Vec<u8>) -> &'a [u8] ;
    fn get_serialized_size_in_bytes(treemap: &Treemap) -> usize;
}
Expand description

Trait for different formats of treemap deserialization

Required Methods§

source

fn serialize_into_writer<W>(treemap: &Treemap, dst: W) -> Result<usize>
where W: Write,

Serialize a treemap into a writer

Returns the number of bytes written, or an error if writing failed

Note tha some serializers (Frozen) may require that the bitmap is aligned specially when reading: this method does not perform any extra alignment. See Self::serialize_into for a method which will return a slice of bytes which are guaranteed to be aligned correctly in memory

source

fn serialize_into<'a>(treemap: &Treemap, dst: &'a mut Vec<u8>) -> &'a [u8]

Serialize a treemap into bytes, using the provided vec buffer to store the serialized data

Note that some serializers (Frozen) may require that bitmaps are aligned specially, this method will ensure that the returned slice of bytes is aligned correctly so that each bitmap is correctly aligned, adding additional padding before the serialized data if required.

The contents of the provided vec buffer will not be overwritten: only new data will be appended to the end of the buffer. If the buffer has enough capacity, and the current end of the buffer is correctly aligned, then no additional allocations will be performed.

Note that this method requires keeping the serialized data in memory: see also the Self::serialize_into_writer method which will write the serialized data directly to a writer

source

fn get_serialized_size_in_bytes(treemap: &Treemap) -> usize

Get the number of bytes required to serialize this bitmap

This does not include any additional padding which may be required to align the treemap

Object Safety§

This trait is not object safe.

Implementors§