Skip to main content

CellDocTree

Struct CellDocTree 

Source
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

Source

pub fn from_document(ctx: &Context, doc: &str) -> Self

Build a reactive tree from a document revision.

Source

pub fn root(&self) -> &CellTree<String, String>

Root tree handle (for wiring derived computeds).

Source

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.

Source

pub fn item_ids( &self, ctx: &Context, component: &str, occurrence: usize, ) -> Vec<String>

Reactive ordered item identities for a component occurrence.

Source

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.

Source

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.

Source

pub fn apply(&mut self, ctx: &Context, diff: &ComponentDiff)

Apply a component diff’s minimal ops to the corresponding occurrence’s item cells, driving the reactive tree to the new shape with minimal invalidation (stable items untouched, moves atomic, only changed values rewritten). Keeps the CellTree children in sync with the CellMap.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.