pub struct PackedLayout {
pub bitmap_bytes: u32,
pub data_start: u32,
pub align: u32,
pub fields: Vec<PackedField>,
pub class_masks: [u64; 4],
}Expand description
Packed layout: the block is a presence bitmap followed by slots for the
present fields only, grouped into size classes (8/4/2/1 bytes) in that
order. Block size and every slot offset depend on which fields are
present, so both are computed per message from the bitmap — in O(1) via
popcount. Limited to 64 fields so the bitmap fits one u64 rank word.
Fields§
§bitmap_bytes: u32Presence bitmap size, ceil(field_count / 8) bytes (1..=8).
data_start: u32Offset where field data begins: align_up(bitmap_bytes, align).
align: u32Max field alignment across the schema (>= 1).
fields: Vec<PackedField>Per field position (ID-sorted).
class_masks: [u64; 4]class_masks[k] has bit p set iff field p belongs to size class
CLASS_SIZES[k].
Implementations§
Source§impl PackedLayout
impl PackedLayout
Sourcepub fn field_offset(&self, bitmap: u64, pos: usize) -> u32
pub fn field_offset(&self, bitmap: u64, pos: usize) -> u32
Byte offset of field pos (which must be present) given the message’s
presence bitmap. O(1): a fixed number of popcounts.
Sourcepub fn block_size(&self, bitmap: u64) -> u32
pub fn block_size(&self, bitmap: u64) -> u32
Total block size for a message with this presence bitmap.
Trait Implementations§
Source§impl Clone for PackedLayout
impl Clone for PackedLayout
Source§fn clone(&self) -> PackedLayout
fn clone(&self) -> PackedLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more