pub struct SiteDeps {
pub path: String,
pub kind: SiteKind,
pub dynamic: bool,
pub reads: BTreeSet<Symbol>,
pub prop_reads: BTreeSet<Symbol>,
}Expand description
One addressable place in a view that can change, and what it depends on.
Fields§
§path: StringDotted child indices from the view root — the patcher’s address for the node.
kind: SiteKind§dynamic: boolDoes this site live under an {if}, a {for each} or an {inspect}?
A site under control flow has no single node: a loop body renders once PER ITEM, and an arm renders only while its condition holds. Its static path therefore names a shape rather than a node, so an in-place patch cannot address it and the update falls back to rebuilding. Marked here, where the walk already knows, rather than re-derived from the path string — a path is not a reliable record of how it was produced.
reads: BTreeSet<Symbol>State fields, already closed over derived fields and template bindings.
prop_reads: BTreeSet<Symbol>Props read here. Separate because a prop cannot change without the PARENT re-rendering this component, so it is not something this instance’s own turns can invalidate.
Implementations§
Source§impl SiteDeps
impl SiteDeps
Sourcepub fn key(&self, interner: &Interner) -> String
pub fn key(&self, interner: &Interner) -> String
kind@path — the site’s identity, and the KEY a renderer records its node under.
The dependency walk and the render walk are two walks over one tree, and two walks drift. Making them agree on a STRING means the agreement can be asserted directly rather than hoped for: a renderer that numbered a child differently records a key the graph never names, and the lock says so.
Sourcepub fn patchable(&self) -> bool
pub fn patchable(&self) -> bool
Can a turn update this site IN PLACE, without rebuilding anything?
Only a value-shaped site under no control flow: it names exactly one node that exists for
as long as the component is mounted. An {if} or a {for each} MOUNTS and UNMOUNTS
subtrees, which is a different operation from writing a value into a node that is already
there.