Skip to main content

repose_tree/
lib.rs

1//! # repose-tree
2//!
3//! Persistent view tree with incremental reconciliation.
4//!
5//! Instead of rebuilding the entire view tree every frame, this module
6//! maintains a persistent tree structure that:
7//!
8//! 1. **Stable Identity**: Nodes have stable IDs across frames
9//! 2. **Change Detection**: Content hashing identifies what changed
10//! 3. **Incremental Updates**: Only changed subtrees are processed
11//! 4. **Layout Caching**: Unchanged nodes keep their cached layout
12//!
13//! ## Architecture
14//!
15//! ```text
16//! ┌─────────────────────────────────────────────────────────┐
17//! │ ViewTree │
18//! │ ┌─────────────────────────────────────────────────────┐│
19//! │ │ nodes: SlotMap<NodeId, TreeNode> ││
20//! │ │ root: NodeId ││
21//! │ │ dirty: FxHashSet<NodeId> ││
22//! │ │ generation: u64 ││
23//! │ └─────────────────────────────────────────────────────┘│
24//! └─────────────────────────────────────────────────────────┘
25//! │
26//! ▼
27//! ┌─────────────────────────────────────────────────────────┐
28//! │ TreeNode │
29//! │ ┌─────────────────────────────────────────────────────┐│
30//! │ │ id: NodeId ││
31//! │ │ view_id: ViewId (stable user-facing ID) ││
32//! │ │ kind: ViewKind ││
33//! │ │ modifier: Modifier ││
34//! │ │ children: SmallVec<[NodeId; 4]> ││
35//! │ │ parent: Option<NodeId> ││
36//! │ │ content_hash: u64 ││
37//! │ │ layout_cache: Option<LayoutCache> ││
38//! │ │ generation: u64 ││
39//! │ └─────────────────────────────────────────────────────┘│
40//! └─────────────────────────────────────────────────────────┘
41//! ```
42
43mod hash;
44mod node;
45mod reconcile;
46mod tree;
47
48pub use hash::*;
49pub use node::*;
50pub use reconcile::*;
51pub use tree::*;
52
53#[cfg(test)]
54mod tests;