pub struct MetaIndex { /* private fields */ }Expand description
A decoded META_MODULE section, held sorted by (key, relative_path).
Every query returns entry refs — borrows into this index — so a caller reads the index, decides, and only then extracts the one archive entry it wants.
Implementations§
Source§impl MetaIndex
impl MetaIndex
Sourcepub fn from_rows(rows: Vec<MetaEntry>) -> Self
pub fn from_rows(rows: Vec<MetaEntry>) -> Self
Build from rows, restoring the on-disk sort. Public so a caller can query a table it just built without a round-trip through a file.
pub fn len(&self) -> usize
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
true when the section is present but records nothing. This is NOT the
same as the archive having no section — see ArchiveMeta.
Sourcepub fn find_by_key(&self, key: &str) -> &[MetaEntry]
pub fn find_by_key(&self, key: &str) -> &[MetaEntry]
All rows carrying exactly key, entry-scoped and archive-scoped alike.
A binary-searched range, not a scan: rows are stored key-major, so this is O(log n) to locate plus O(hits) to hand back.
Sourcepub fn find_by_prefix(&self, prefix: &str) -> &[MetaEntry]
pub fn find_by_prefix(&self, prefix: &str) -> &[MetaEntry]
All rows whose key starts with prefix — also a contiguous range, for the
same reason. An empty prefix matches everything.
Sourcepub fn archive_value(&self, key: &str) -> Option<&MetaValue>
pub fn archive_value(&self, key: &str) -> Option<&MetaValue>
The archive-level value for key, if one was recorded.