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 for 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 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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ViewTree
impl !RefUnwindSafe for ViewTree
impl !Send for ViewTree
impl !Sync for ViewTree
impl Unpin for ViewTree
impl !UnwindSafe for ViewTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more