pub struct ViewTree {
pub stats: TreeStats,
pub removed_ids: Vec<NodeId>,
/* private fields */
}Expand description
A persistent view tree that supports incremental updates.
Fields§
§stats: TreeStatsStatistics from the last reconcile operation.
removed_ids: Vec<NodeId>Nodes removed during the last update (needed to sync external systems like Taffy).
Implementations§
Source§impl ViewTree
impl ViewTree
Sourcepub fn set_subcompose_scope(&mut self, scope: SubcomposeScope)
pub fn set_subcompose_scope(&mut self, scope: SubcomposeScope)
Set the constraints that will be passed to any SubcomposeLayout
content closures during the next update call.
The scope is read once per reconcile of a SubcomposeLayout node; if
you need different scopes at different depths, the closure itself is
responsible for narrowing the values it receives.
Sourcepub fn subcompose_scope(&self) -> SubcomposeScope
pub fn subcompose_scope(&self) -> SubcomposeScope
Get the currently-set subcompose scope.
Sourcepub fn invalidate_subcompose_cache(&mut self, node_id: NodeId)
pub fn invalidate_subcompose_cache(&mut self, node_id: NodeId)
Drop the cached subcomposed view for a single node. Call this when the
SubcomposeLayout’s modifier or identity changes so the next
reconciliation re-invokes the closure.
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Get the current generation.
Sourcepub fn get_by_view_id(&self, view_id: ViewId) -> Option<&TreeNode>
pub fn get_by_view_id(&self, view_id: ViewId) -> Option<&TreeNode>
Get a node by ViewId.
Sourcepub fn dirty_nodes(&self) -> &FxHashSet<NodeId>
pub fn dirty_nodes(&self) -> &FxHashSet<NodeId>
Get the set of dirty nodes.
Sourcepub fn clear_dirty(&mut self)
pub fn clear_dirty(&mut self)
Clear the dirty set (after layout).
Sourcepub fn mark_dirty(&mut self, id: NodeId)
pub fn mark_dirty(&mut self, id: NodeId)
Mark a node as needing re-layout.
Sourcepub fn update(&mut self, new_root: &View) -> NodeId
pub fn update(&mut self, new_root: &View) -> NodeId
Update the tree from a new View, performing incremental reconciliation. Returns the root NodeId.
Sourcepub fn set_layout(
&mut self,
id: NodeId,
rect: Rect,
screen_rect: Rect,
constraints: LayoutConstraints,
)
pub fn set_layout( &mut self, id: NodeId, rect: Rect, screen_rect: Rect, constraints: LayoutConstraints, )
Set cached layout for a node.
Sourcepub fn iter(&self) -> impl Iterator<Item = &TreeNode>
pub fn iter(&self) -> impl Iterator<Item = &TreeNode>
Iterate over all nodes (parent before children).
Sourcepub fn iter_with_ids(&self) -> impl Iterator<Item = (NodeId, &TreeNode)>
pub fn iter_with_ids(&self) -> impl Iterator<Item = (NodeId, &TreeNode)>
Iterate over all nodes with their IDs.