pub struct IndexBlob {
pub indexes: Vec<Index>,
}Expand description
The index region of one table.
Fields§
§indexes: Vec<Index>Implementations§
Source§impl IndexBlob
impl IndexBlob
Sourcepub fn parse(
data: &[u8],
table_offset: usize,
relation: Option<&Relation>,
) -> Result<Self>
pub fn parse( data: &[u8], table_offset: usize, relation: Option<&Relation>, ) -> Result<Self>
Parse the region.
table_offset is where the region sits within its table, which the stored
offsets are measured against. relation supplies the attribute formats
needed to tell an integer key from a length-prefixed one; without it the
entries cannot be decoded.
Sourcepub fn to_bytes(&self, table_offset: usize) -> Vec<u8> ⓘ
pub fn to_bytes(&self, table_offset: usize) -> Vec<u8> ⓘ
Serialize, recomputing every offset from table_offset.
pub fn encoded_len(&self) -> usize
Sourcepub fn insert_record(
&mut self,
record_number: u32,
key: impl Fn(u32) -> IndexValue,
)
pub fn insert_record( &mut self, record_number: u32, key: impl Fn(u32) -> IndexValue, )
Index a record in every index of the table.
key maps an attribute id to that attribute’s key value.
Sourcepub fn insert_record_where(
&mut self,
record_number: u32,
key: impl Fn(u32) -> IndexValue,
indexable: impl Fn(&[u32]) -> bool,
)
pub fn insert_record_where( &mut self, record_number: u32, key: impl Fn(u32) -> IndexValue, indexable: impl Fn(&[u32]) -> bool, )
Index a record only in the indexes indexable accepts.
It is called with an index’s attribute ids, and answers whether the record belongs in that index — macOS leaves a record out of an index when it has no value for an indexed attribute.
Sourcepub fn remove_record(&mut self, record_number: u32)
pub fn remove_record(&mut self, record_number: u32)
Drop entries for a record, and renumber the entries that referred to later records.