Expand description
Recycling-tree driver (docs/tree.md). crate::list’s shape addressed by token instead of
row index: the native tree host owns scrolling, disclosure and cell reuse; Day owns row
content. day-core injects a day_spec::TreeSource into the backend; when the native
data-source pulls a cell, bind_row builds it once (per physical cell) and thereafter
rebinds it (one slot-write) as the cell recycles.
Re-entrancy follows list.rs exactly: bind_row phases the tree borrow:
with_tree (adopt cell) → build/rebind + flush_sync outside any borrow → with_tree
(lay the row out in its cell). Holding the borrow across the build would deadlock the RefCell.
Structs§
- Tree
Built Row - A freshly built tree row: its
Scope(owns the row’s reactive graph) and a rebind writer that slot-writestoken’s row into the cell’s slot when the cell is recycled. - Tree
Driver - Supplied by the
tree()piece, type-erased over the item type. day-core invokes these to answer the native data-source and to build/rebind rows. All hierarchy queries are token-addressed (None= the root level); see docs/tree.md for why indices cannot address tree rows. - Tree
Moves Driver - The move closures the
tree()piece supplies (docs/tree.md). Exposed to the backend asday_spec::TreeMovesby the tree source adapter; also driven directly bytree_try_move(the dayscripttree_move:step and the mock probe).
Enums§
- Tree
Cell Step - Whether a
bind_rowmust build a new row (fresh anchor) or rebind a recycled cell.
Functions§
- install_
tree - Register a tree’s driver and wire its native host’s data-source. Call after the tree node
and its native handle exist (from within the piece build;
with_treeis acquired per op). - tree_
driver - The tree’s driver, for the guard → commit paths run outside the borrow (
Nonewhennodehosts no tree). - tree_
reload - Tell the native tree its data changed (re-query the source). Expansion and selection survive by token (docs/tree.md). Call with no borrow held.
- tree_
reveal - Scroll this row into view, realizing it if needed. The piece expands the row’s ancestors (through the app’s expansion signal) before issuing this. Call with no borrow held.
- tree_
set_ expanded - Programmatically disclose or collapse one row. Applied by the toolkit without re-emitting
Event::TreeExpanded; redundant applications are no-ops. Call with no borrow held. - tree_
set_ selected - Programmatically sync the tree’s selected rows (empty = clear). Applied by the toolkit without re-emitting a selection event. Call with no borrow held.
- tree_
try_ move - Programmatically move a tree row through the same guard → commit path a native drag takes
(docs/tree.md): consult the piece’s guards, defer the app’s
on_move, and tell the native host to re-query. This is how the dayscripttree_move:step and the mock probe drive moves without a native gesture. Call with no borrow held. - tree_
visible_ rows - The flattened visible rows:
(token, depth)in display order, descending only into expanded rows (docs/tree.md). The shared substrate the emulated backends, the keyboard handler and the mock probe all read; one implementation, kind-agnostic over any token tree.
Type Aliases§
- RowMenu
Fn - A row’s summon-time context-menu builder (aliased for the field above).
- RowResolver
- A
.row_idstring → token resolver (aliased for the field above; clippy’s type-complexity bound).