pub struct CellDocTree { /* private fields */ }Expand description
A reactive, per-item representation of a document: a CellTree root whose
children are component-occurrence subtrees, each of whose children are item
value cells.
The tree id scheme: the root id is "", a component-occurrence node id is
component:occurrence, and an item leaf id is its reorder-stable node-key
identity (component:occurrence:item-id). Applying ComponentDiff ops via
CellDocTree::apply mutates only the touched item cells / order signals —
a single-item edit invalidates exactly that leaf’s value cell and nothing
else (per-cell isolation).
Implementations§
Source§impl CellDocTree
impl CellDocTree
Sourcepub fn from_document(ctx: &Context, doc: &str) -> Self
pub fn from_document(ctx: &Context, doc: &str) -> Self
Build a reactive tree from a document revision.
Sourcepub fn root(&self) -> &CellTree<String, String>
pub fn root(&self) -> &CellTree<String, String>
Root tree handle (for wiring derived computeds).
Sourcepub fn item_value(
&self,
ctx: &Context,
component: &str,
occurrence: usize,
identity: &str,
) -> Option<String>
pub fn item_value( &self, ctx: &Context, component: &str, occurrence: usize, identity: &str, ) -> Option<String>
Reactively read an item’s value by its reorder-stable identity, or None
if absent. A reader is invalidated only when that item changes.
Sourcepub fn item_ids(
&self,
ctx: &Context,
component: &str,
occurrence: usize,
) -> Vec<String>
pub fn item_ids( &self, ctx: &Context, component: &str, occurrence: usize, ) -> Vec<String>
Reactive ordered item identities for a component occurrence.
Sourcepub fn update_to(&mut self, ctx: &Context, old_doc: &str, new_doc: &str)
pub fn update_to(&mut self, ctx: &Context, old_doc: &str, new_doc: &str)
Incrementally update this tree from old_doc to new_doc, using the
document diff + apply path instead of rebuilding every occurrence.
Sourcepub fn unresolved_prompt_counts(&self, ctx: &Context) -> SemTree<String, usize>
pub fn unresolved_prompt_counts(&self, ctx: &Context) -> SemTree<String, usize>
A small agent-doc semantic query over the reactive tree: unresolved
prompt counts per subtree, memoized by lazily’s SemTree.