Skip to main content

Module list

Module list 

Source
Expand description

Recycling-list driver (docs/list.md, §10). The native list host owns scrolling + cell reuse; Day owns row content. day-core injects a day_spec::ListSource 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 (the crux): building a row uses BuildCx, and reactive bindings patch native widgets — both acquire with_tree per operation. So 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§

BuiltRow
A freshly built row: its Scope (owns the row’s reactive graph) and a rebind writer that slot-writes item index into the row’s ItemSlot when the cell is recycled.
ListDriver
Supplied by the list() piece, type-erased over the item type. day-core invokes these to answer the native data-source and to build/rebind rows.
ListReorderDriver
The reorder closures the list() piece supplies (docs/list.md). Exposed to the backend as day_spec::ListReorder by [make_source]; also driven directly by list_try_reorder (the dayscript reorder step and the mock probe).

Enums§

CellStep
Whether a bind_row must build a new row (fresh anchor) or rebind a recycled cell.

Functions§

install_list
Register a list’s driver and wire its native host’s data-source. Call after the LIST node and its native handle exist (from within the piece build; with_tree is acquired per op).
list_reload
Tell the native list its data changed (re-query the source). Call with no borrow held.
list_scroll_to_end
Imperatively scroll the native list so its last row is fully visible (chat “stick to bottom”). A no-op while the list is empty. Call with no borrow held.
list_scroll_to_row
Imperatively scroll the native list so row row is visible (docs/list.md), realizing it if needed. Clamped to the row count; a no-op while the list is empty. Call with no borrow held.
list_set_selected
Programmatically sync the list’s selected rows (empty = clear selection). Applied by the toolkit without re-emitting a selection event. Call with no borrow held.
list_try_reorder
Programmatically reorder a list row through the same guard → commit path a native drag takes (docs/list.md): consult the piece’s guard (which may retarget), rotate the snapshot, defer the app’s on_reorder, and tell the native host to re-query. This is how the dayscript reorder step and the mock probe drive reordering without a native gesture. Returns the index the row actually landed at. Call with no borrow held.
Day API ↩ Guides· daybrite.dev