Skip to main content

TreeSource

Struct TreeSource 

Source
pub struct TreeSource {
Show 13 fields pub children_len: Rc<dyn Fn(Option<u64>) -> usize>, pub child_token: Rc<dyn Fn(Option<u64>, usize) -> u64>, pub expandable: Rc<dyn Fn(u64) -> bool>, pub section_header: Rc<dyn Fn(u64) -> bool>, pub expanded: Rc<dyn Fn(u64) -> bool>, pub bind_row: Rc<dyn Fn(u64, RawHandle)>, pub recycle: Rc<dyn Fn(RawHandle)>, pub layout_cell: Rc<dyn Fn(RawHandle, f64)>, pub layout_cell_size: Rc<dyn Fn(RawHandle, Size)>, pub cell_height: Rc<dyn Fn(RawHandle) -> f64>, pub type_select_text: Rc<dyn Fn(u64) -> String>, pub row_menu: Option<Rc<dyn Fn(u64) -> Vec<MenuItem>>>, pub moves: Option<TreeMoves>,
}
Expand description

The synchronous row-pull closures for hierarchical trees (docs/tree.md): ListSource’s shape, addressed by token instead of row index, because expanding a row renumbers every index below it while tokens hold still. day-core injects one per TREE host via Toolkit::attach_tree; the backend answers its native data-source from it. The same synchronous discipline as ListSource: UI thread, outside any day-core borrow; bind_row flushes and lays the row out before returning.

Fields§

§children_len: Rc<dyn Fn(Option<u64>) -> usize>

How many children parent has (None = the root level).

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

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

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

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

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

Non-selectable section heading, separate from a navigation destination.

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

Current desired expansion, including restoration before the first native reload.

§bind_row: Rc<dyn Fn(u64, RawHandle)>

Build (first use of this cell) or rebind (recycled cell) the row for token into the native cell.

§recycle: Rc<dyn Fn(RawHandle)>

The native cell left the viewport; Day may drop per-cell bookkeeping (optional).

§layout_cell: Rc<dyn Fn(RawHandle, f64)>

Re-lay the row bound to this cell at width, called from the cell’s own native layout pass. Trees need this where lists don’t: indentation makes every cell’s content width per-row, so the host-width layout bind_row did is only a first approximation. Skips quietly when called inside a day-core borrow (a snapshot pass).

§layout_cell_size: Rc<dyn Fn(RawHandle, Size)>

Native bounds for controls whose group headers have a different height from leaves. Overrides the initial row-height estimate and preserves the native height on rebind.

§cell_height: Rc<dyn Fn(RawHandle) -> f64>

The height day-core last laid this cell’s row at (see ListSource::cell_height).

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

The row’s type-ahead string (docs/tree.md): what native type-select matches against.

§row_menu: Option<Rc<dyn Fn(u64) -> Vec<MenuItem>>>

The row’s context menu, built when the menu is summoned (docs/menus.md “Dynamic context menus”), called on the UI thread from the platform’s own menu callback, outside any day-core borrow, like every closure here. None = rows carry no menu; an empty result suppresses the menu for that row.

§moves: Option<TreeMoves>

Drag-to-move closures, present when TreeProps::movable (docs/tree.md). None on immovable trees; backends must not enable their drag machinery without it.

Trait Implementations§

Source§

impl Clone for TreeSource

Source§

fn clone(&self) -> TreeSource

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Day API ↩ Guides· daybrite.dev