pub struct PlanIndex<'d> { /* private fields */ }Expand description
A plan document’s id lookups, built and validated once.
Transient by construction: it borrows the document, so it is built where it is used and dropped there. That is already what every hand-rolled copy of this map did — the difference is that the ids are checked on the way in, so every accessor below is total and none of them can panic.
Implementations§
Source§impl<'d> PlanIndex<'d>
impl<'d> PlanIndex<'d>
Sourcepub fn build(doc: &'d PlanDocument) -> Result<Self, EngineError>
pub fn build(doc: &'d PlanDocument) -> Result<Self, EngineError>
Build, validating every id the document refers to: hunk ids parse and are in range, class ids referenced by groups exist.
Before this existed the two renderers disagreed about a broken
document — crates/stack panicked on an unresolvable class reference
and the TUI silently dropped it, so a corrupt store showed a short
group with no indication anything was missing.
pub fn doc(&self) -> &'d PlanDocument
Sourcepub fn groups(&self) -> &'d [Group]
pub fn groups(&self) -> &'d [Group]
The document’s groups, or an empty slice for a core-only document.
Sourcepub fn class(&self, id: &str) -> &'d ClassEntry
pub fn class(&self, id: &str) -> &'d ClassEntry
Total: build proved every referenced class id resolves.
pub fn exemplar(&self, class_id: &str) -> HunkId
pub fn class_hunks(&self, class_id: &str) -> Vec<HunkId>
Sourcepub fn group_hunks(&self, group: &Group) -> Vec<HunkId>
pub fn group_hunks(&self, group: &Group) -> Vec<HunkId>
Group members in class order — the order both renderers already emit.