Trait croaring::bitmap::Deserializer

source ·
pub trait Deserializer {
    // Required methods
    fn try_deserialize(buffer: &[u8]) -> Option<Bitmap>;
    unsafe fn try_deserialize_unchecked(buffer: &[u8]) -> Bitmap;
}
Expand description

Trait for different formats of bitmap deserialization

Required Methods§

source

fn try_deserialize(buffer: &[u8]) -> Option<Bitmap>

Try to deserialize a bitmap from the beginning of the provided buffer

The Bitmap::try_deserialize method should usually be used instead of this method directly.

If the buffer starts with the serialized representation of a bitmap, then this method will return a new bitmap containing the deserialized data.

If the buffer does not start with a serialized bitmap (or contains an invalidly truncated bitmap), then this method will return None.

To determine how many bytes were consumed from the buffer, use the Serializer::get_serialized_size_in_bytes method on the returned bitmap.

source

unsafe fn try_deserialize_unchecked(buffer: &[u8]) -> Bitmap

Deserialize a bitmap from the beginning of the provided buffer

§Safety

Unlike its safe counterpart (Self::try_deserialize) this function assumes the data is valid, passing data which does not contain/start with a bitmap serialized with this format will result in undefined behavior.

Object Safety§

This trait is not object safe.

Implementors§