Expand description
§repose-tree
Persistent view tree with incremental reconciliation.
Instead of rebuilding the entire view tree every frame, this module maintains a persistent tree structure that:
- Stable Identity: Nodes have stable IDs across frames
- Change Detection: Content hashing identifies what changed
- Incremental Updates: Only changed subtrees are processed
- Layout Caching: Unchanged nodes keep their cached layout
§Architecture
┌─────────────────────────────────────────────────────────┐
│ ViewTree │
│ ┌─────────────────────────────────────────────────────┐│
│ │ nodes: SlotMap<NodeId, TreeNode> ││
│ │ root: NodeId ││
│ │ dirty: FxHashSet<NodeId> ││
│ │ generation: u64 ││
│ └─────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ TreeNode │
│ ┌─────────────────────────────────────────────────────┐│
│ │ id: NodeId ││
│ │ view_id: ViewId (stable user-facing ID) ││
│ │ kind: ViewKind ││
│ │ modifier: Modifier ││
│ │ children: SmallVec<[NodeId; 4]> ││
│ │ parent: Option<NodeId> ││
│ │ content_hash: u64 ││
│ │ layout_cache: Option<LayoutCache> ││
│ │ generation: u64 ││
│ └─────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────┘Structs§
- Layout
Cache - Cached layout information for a node.
- Layout
Constraints - Constraints used during layout.
- NodeId
- Internal node identifier, stable within a tree’s lifetime.
- Reconcile
Context - Context for a reconciliation pass.
- Tree
Node - A node in the persistent view tree.
- Tree
Stats - Statistics about tree operations.
- View
Tree - A persistent view tree that supports incremental updates.
Functions§
- hash_
subtree - Compute a hash that includes the subtree structure. This combines the node’s content hash with its children’s subtree hashes.
- hash_
view_ content - Compute a content hash for a View’s immediate properties. This does NOT include children - that’s handled separately.