Trait croaring::bitmap::Serializer
source · pub trait Serializer {
// Required methods
fn serialize_into<'a>(bitmap: &Bitmap, dst: &'a mut Vec<u8>) -> &'a [u8] ⓘ;
fn get_serialized_size_in_bytes(bitmap: &Bitmap) -> usize;
}
Expand description
Trait for different formats of bitmap serialization
Required Methods§
sourcefn serialize_into<'a>(bitmap: &Bitmap, dst: &'a mut Vec<u8>) -> &'a [u8] ⓘ
fn serialize_into<'a>(bitmap: &Bitmap, dst: &'a mut Vec<u8>) -> &'a [u8] ⓘ
Serialize a bitmap into bytes, using the provided vec buffer to store the serialized data
Note that some serializers (Frozen) may require that the bitmap is aligned specially, this method will ensure that the returned slice of bytes is aligned correctly, by 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.
sourcefn get_serialized_size_in_bytes(bitmap: &Bitmap) -> usize
fn get_serialized_size_in_bytes(bitmap: &Bitmap) -> 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 bitmap