pub struct TreeNode {
pub id: NodeId,
pub view_id: ViewId,
pub kind: ViewKind,
pub modifier: Modifier,
pub children: SmallVec<[NodeId; 4]>,
pub parent: Option<NodeId>,
pub content_hash: u64,
pub subtree_hash: u64,
pub layout_cache: Option<LayoutCache>,
pub generation: u64,
pub user_key: Option<u64>,
pub depth: u32,
}Expand description
A node in the persistent view tree.
Fields§
§id: NodeIdInternal slotmap key.
view_id: ViewIdUser-facing stable view ID (for hit testing, focus, etc.).
kind: ViewKindThe kind of view this node represents.
modifier: ModifierLayout and styling modifiers.
children: SmallVec<[NodeId; 4]>Child node IDs.
parent: Option<NodeId>Parent node ID (None for root).
content_hash: u64Hash of this node’s content (kind + modifier + children structure). Used for change detection.
subtree_hash: u64Hash including all descendants. If this matches, the entire subtree is unchanged.
layout_cache: Option<LayoutCache>Cached layout result.
generation: u64Generation when this node was last updated.
user_key: Option<u64>Key provided by user for stable identity in dynamic lists.
depth: u32Depth in tree (root = 0).
Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn new(
id: NodeId,
view_id: ViewId,
kind: ViewKind,
modifier: Modifier,
generation: u64,
) -> Self
pub fn new( id: NodeId, view_id: ViewId, kind: ViewKind, modifier: Modifier, generation: u64, ) -> Self
Create a new tree node.
Sourcepub fn has_valid_layout(&self) -> bool
pub fn has_valid_layout(&self) -> bool
Check if this node’s layout cache is still valid.
Sourcepub fn invalidate_layout(&mut self)
pub fn invalidate_layout(&mut self)
Invalidate layout cache (called when content changes).
Sourcepub fn cached_rect(&self) -> Option<Rect>
pub fn cached_rect(&self) -> Option<Rect>
Get cached layout if available.
pub fn set_layout(&mut self, rect: Rect)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TreeNode
impl !RefUnwindSafe for TreeNode
impl !Send for TreeNode
impl !Sync for TreeNode
impl Unpin for TreeNode
impl UnsafeUnpin for TreeNode
impl !UnwindSafe for TreeNode
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