pub struct TreeNode {Show 13 fields
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,
pub scope_key: Option<String>,
}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).
scope_key: Option<String>If this node is a scope boundary (set by scope! macro), this holds the
scope key (e.g., “title”, “color_buttons”). None for non-scope nodes.
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.