Skip to main content

Module tree_driver

Module tree_driver 

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

TreeBuiltRow
A freshly built tree row: its Scope (owns the row’s reactive graph) and a rebind writer that slot-writes token’s row into the cell’s slot when the cell is recycled.
TreeDriver
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.
TreeMovesDriver
The move closures the tree() piece supplies (docs/tree.md). Exposed to the backend as day_spec::TreeMoves by the tree source adapter; also driven directly by tree_try_move (the dayscript tree_move: step and the mock probe).

Enums§

TreeCellStep
Whether a bind_row must 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_tree is acquired per op).
tree_driver
The tree’s driver, for the guard → commit paths run outside the borrow (None when node hosts 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 dayscript tree_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§

RowMenuFn
A row’s summon-time context-menu builder (aliased for the field above).
RowResolver
A .row_id string → token resolver (aliased for the field above; clippy’s type-complexity bound).