Skip to main content

Crate repose_tree

Crate repose_tree 

Source
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:

  1. Stable Identity: Nodes have stable IDs across frames
  2. Change Detection: Content hashing identifies what changed
  3. Incremental Updates: Only changed subtrees are processed
  4. 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§

LayoutCache
Cached layout information for a node.
LayoutConstraints
Constraints used during layout.
NodeId
Internal node identifier, stable within a tree’s lifetime.
ReconcileContext
Context for a reconciliation pass.
TreeNode
A node in the persistent view tree.
TreeStats
Statistics about tree operations.
ViewTree
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.