Skip to main content

TreeDriver

Struct TreeDriver 

Source
pub struct TreeDriver {
    pub row_height: RowHeight,
    pub children_len: Box<dyn Fn(Option<u64>) -> usize>,
    pub child_token: Box<dyn Fn(Option<u64>, usize) -> u64>,
    pub expandable: Box<dyn Fn(u64) -> bool>,
    pub section_header: Box<dyn Fn(u64) -> bool>,
    pub expanded: Box<dyn Fn(u64) -> bool>,
    pub build: Box<dyn Fn(u64, RNode) -> TreeBuiltRow>,
    pub type_select_text: Box<dyn Fn(u64) -> String>,
    pub resolve_row: RowResolver,
    pub row_menu: Option<RowMenuFn>,
    pub moves: Option<TreeMovesDriver>,
}
Expand description

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.

Fields§

§row_height: RowHeight§children_len: Box<dyn Fn(Option<u64>) -> usize>

How many children parent has (reads the piece’s snapshot; no tree access).

§child_token: Box<dyn Fn(Option<u64>, usize) -> u64>

The i-th child of parent: the stable token every backend keys its rows by.

§expandable: Box<dyn Fn(u64) -> bool>

Whether this token can hold children at all (draws or omits the disclosure).

§section_header: Box<dyn Fn(u64) -> bool>§expanded: Box<dyn Fn(u64) -> bool>

The piece’s current desired expansion state for this token (untracked read of the app’s expansion signal), which is what the flattener descends into.

§build: Box<dyn Fn(u64, RNode) -> TreeBuiltRow>

Build the row for token into anchor. Uses BuildCx internally, so it must be called with no with_tree borrow held. Returns the row’s scope + a rebind writer.

§type_select_text: Box<dyn Fn(u64) -> String>

The row’s type-ahead string (docs/tree.md); native type-select answers from it.

§resolve_row: RowResolver

Resolve a dayscript row id (the piece’s .row_id string) to its token. This is how the expand:/tree_move: steps and the mock address rows without native gestures.

§row_menu: Option<RowMenuFn>

The row’s summon-time context menu (docs/menus.md), None = no row menus.

§moves: Option<TreeMovesDriver>

Drag-to-move half, present when the piece is .movable(true) (docs/tree.md).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.