Skip to main content

Module codec

Module codec 

Source
Expand description

zerompk ToMessagePack / FromMessagePack implementations for SurrogateBitmap.

Wire encoding: a single msgpack bin value whose bytes are the portable roaring-bitmap serialization produced by RoaringBitmap::serialize_into. This is the most compact format that survives cross-platform round-trips and can be decoded without allocating an intermediate Vec<u8> on the read side.

The zerompk bin type maps to msgpack’s binary ext (0xc4/0xc5/0xc6 family). Note: zerompk’s derive macro does not use this family for plain Vec<u8> fields — by default it routes through the generic impl<T: ToMessagePack> ToMessagePack for Vec<T> which writes a MessagePack array (fixarray / array16 / array32) with each u8 as a uint8 marker. The derive macro only emits write_binary / read_binary when the field carries the #[as_bytes] attribute. Manually implementing the binary encoding here keeps SurrogateBitmap interchangeable with the hand-rolled binary Option<Vec<u8>> fields in TextFields (which call writer.write_binary directly to dodge the array fallback).