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.
ListDeleteDriver
The delete closures the list() piece supplies (docs/list.md). Exposed to the backend as day_spec::ListDelete by the list source adapter; also driven directly by list_try_delete (the dayscript delete_row step and the mock probe).
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 the list source adapter; also driven directly by list_try_reorder (the dayscript reorder step and the mock probe).
ListSectionsDriver
The section half the list() piece supplies (docs/list.md “Sections”): a key per item and a header builder. A header row precedes every item whose key differs from the item before.
ListSwipeDriver
The swipe-action closures the list() piece supplies (docs/list.md). Exposed to the backend as day_spec::ListSwipe by the list source adapter; also driven directly by list_try_swipe (the dayscript swipe_row 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
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_editing
Enter or leave the list’s native editing mode (ListPatch::Editing, docs/list.md).
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_splice
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. Row-level deltas to the native host: the animatable alternative to list_reload, for sources that know exactly how their set changed (a live query’s maintainer does).
list_try_delete
Programmatically delete a list row through the same guard → commit path a native swipe takes (docs/list.md): consult the piece’s guard, drop the row from the snapshot, defer the app’s on_delete, and tell the native host to re-query. This is how the dayscript delete_row step and the mock probe drive deletion without a native gesture. 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.
list_try_swipe
Programmatically run a swipe action through the same offer → commit path a native gesture takes (docs/list.md): pull the row’s offer for the edge, refuse when the action is not in it, and defer the commit. This is how the dayscript swipe_row step and the mock probe drive the swipe path without a native gesture. expect pins the button by its label: offers are state-dependent, and a pinned step must refuse to press a different button rather than press it and complain (pressing anyway flips state the script did not mean to flip, which is how one aborted run poisons every later one). Answers the activated label. Call with no borrow held.
set_scripted_reorder
Route list_try_reorder at node (the dayscript reorder step) to reorder, for a piece that reorders rows with no list driver of its own. reorder gets the step’s from and to and answers where the row landed, or why it did not move. Replaces any earlier route.