Skip to main content

Tree

Struct Tree 

Source
pub struct Tree<B: Toolkit> {
    pub toolkit: B,
    /* private fields */
}

Fields§

§toolkit: B

Implementations§

Source§

impl<B: Toolkit> Tree<B>

Source

pub fn new(toolkit: B, root_handle: B::Handle, window_size: Size) -> Self

Source

pub fn root(&self) -> RNode

Trait Implementations§

Source§

impl<B: Toolkit> TreeOps for Tree<B>

Source§

fn capability(&self, cap: Cap) -> Support

Toolkit capability probe (pieces pick presentation with it, e.g. Cap::NavSplit).
Source§

fn supports_lifecycle(&self, phase: Lifecycle) -> bool

Does the running backend deliver this lifecycle phase (docs/lifecycle.md)?
Source§

fn present(&mut self, req: u64, spec: &PresentSpec)

Present a native modal for request req (docs/dialogs.md).
Source§

fn dismiss(&mut self, req: u64)

Dismiss the modal for req (programmatic resolve while it is still up).
Source§

fn open_url(&mut self, url: &str)

Open url in the platform’s default handler (the link piece’s seam).
Source§

fn set_appearance(&mut self, dark: Option<bool>)

Apply an app-level appearance override (see Toolkit::set_appearance).
Source§

fn defer_system_gestures(&mut self, edges: Edges)

Re-send the union of every mounted defers_system_gestures request (docs/cover.md).
Source§

fn create_node( &mut self, kind: PieceKind, props: &dyn Any, layout: Rc<dyn Layout>, flex: Flex, native: bool, is_boundary: bool, scope: Scope, ) -> RNode

Source§

fn attach(&mut self, parent: RNode, child: RNode)

Source§

fn attach_at(&mut self, parent: RNode, child: RNode, index: usize)

Source§

fn reorder_children(&mut self, parent: RNode, order: Vec<RNode>)

Source§

fn remove_subtree(&mut self, node: RNode)

Source§

fn on_event(&mut self, node: RNode, h: EventHandler)

Source§

fn handlers_for(&self, node: RNode) -> Vec<EventHandler>

Source§

fn node_exists(&self, node: RNode) -> bool

Whether node still exists (diagnostics: stale-id probes).
Source§

fn dark_mode(&mut self) -> bool

Whether the platform renders in dark appearance (see Toolkit::dark_mode).
Source§

fn set_id(&mut self, node: RNode, id: String)

Source§

fn set_grid_facts(&mut self, node: RNode, facts: GridFacts)

Merge non-default grid cell facts onto a node’s Flex — the .grid_span/.grid_align seam (docs/grid.md). Called at build time, before the first layout.
Source§

fn set_a11y(&mut self, node: RNode, a11y: A11yProps)

Source§

fn enable_gesture(&mut self, node: RNode, kind: GestureKind)

Attach a native gesture recognizer to node (docs/shapes.md): the backend then emits Event::Tap/LongPress/Drag for it. The node must have a native handle.
Source§

fn focus_node(&mut self, node: RNode, focused: bool)

Move native keyboard focus to (or away from) node (docs/focus.md).
Source§

fn set_probe_focused(&mut self, node: RNode, focused: bool)

Mirror a FocusChanged event into the node’s dayscript probe (pump-only).
Source§

fn set_app_menu(&mut self, items: Vec<MenuItem>)

Source§

fn set_window_toolbar(&mut self, root: RNode, items: Vec<ToolbarItem>)

Install root’s window toolbar (docs/toolbars.md). root is a window root — the primary root or one returned by open_window_root.
Source§

fn patch_window_toolbar(&mut self, root: RNode, patch: ToolbarPatch)

Apply a targeted change to one item of root’s toolbar.
Source§

fn set_context_menu(&mut self, node: RNode, items: Vec<MenuItem>)

Source§

fn scroll_to_target( &mut self, node: RNode, target: &ScrollTarget, animated: bool, ) -> bool

Programmatic scroll (§7.6, docs/scroll.md): resolve target against a SCROLL node’s content/viewport and drive Toolkit::scroll_to. Returns false when node isn’t a realized scroll (the caller reports the miss; dayscript retries).
Source§

fn scroll_reveal(&mut self, node: RNode, animated: bool) -> bool

Scroll the nearest enclosing SCROLL ancestor so node’s frame is visible (minimal scroll, scrollRectToVisible semantics). False when no scroll ancestor exists.
Source§

fn patch(&mut self, node: RNode, patch: Box<dyn Any>, affects_size: bool)

Source§

fn set_implicit_anim(&mut self, node: RNode, anim: Option<AnimSpec>)

Set (or clear) a node’s implicit .animation (§8.4): subsequent property patches and frame changes on this node (or its descendants) animate with anim even outside a with_animation.
Source§

fn set_node_opacity(&mut self, node: RNode, opacity: f64)

Apply an animatable opacity (0..1) to node’s native handle (§8.4), animating if an animation is in scope. No-op if the node has no handle.
Source§

fn set_node_transform(&mut self, node: RNode, t: Transform)

Apply an animatable [Transform] to node’s native handle (§8.4) — the cheap movement/ scaling channel that never relayouts. No-op if the node has no handle.
Source§

fn set_node_selectable(&mut self, node: RNode, selectable: bool)

Make node’s text user-selectable (the .selectable() modifier). One-shot and unmanaged; No-op if the node has no handle.
Source§

fn replay(&mut self, node: RNode, ops: Vec<DrawOp>)

Source§

fn mark_needs_measure(&mut self, node: RNode)

Source§

fn mark_layout_dirty(&mut self)

Source§

fn layout_if_needed(&mut self)

Source§

fn set_route(&mut self, route: &str)

Report the app’s current route to the backend (Toolkit::set_route) — web-dom mirrors it into the URL hash (docs/navigation.md). Called by the turn-end route sync when the route actually changed.
Source§

fn set_window_size(&mut self, s: Size)

Source§

fn child_count(&self, node: RNode) -> usize

Source§

fn first_child(&self, node: RNode) -> Option<RNode>

Source§

fn node_kind(&self, node: RNode) -> Option<PieceKind>

Source§

fn node_id(&self, node: RNode) -> Option<String>

The app-authored .id() string on node (find_by_id’s inverse), or None for an id-less or disposed node. Backs the free id_of — the recorder’s NodeId → id lookup (§14.6).
Source§

fn node_handle_any(&self, node: RNode) -> Option<Box<dyn Any>>

A CLONE of the node’s native handle boxed as Any (None for layout-only or disposed nodes). TreeOps is object-safe, so the generic Toolkit::Handle can’t appear here — toolkit ext modules downcast to their concrete Handle type. This is the tweaks door (docs/tweaks.md): cloning is cheap on every backend (a retain / gobject ref / GlobalRef clone / Copy pointer) and the clone never outlives the native widget’s own refcounting.
Source§

fn node_frame(&self, node: RNode) -> Option<Rect>

Source§

fn node_probe(&self, node: RNode) -> Option<NodeProbe>

Source§

fn node_a11y(&self, node: RNode) -> Option<A11yProps>

The node’s accumulated accessibility annotations (§13) — a11y_audit’s expectation.
Source§

fn read_a11y(&self, node: RNode) -> Option<A11ySnapshot>

The node’s ACTUAL native a11y properties (a11y_audit diffs this against node_a11y).
Source§

fn a11y_nodes(&self) -> Vec<(String, PieceKind, A11yProps, A11ySnapshot)>

For every node with an .id() and a native handle: (id, kind, expected, actual) — the raw material for the a11y_audit step (§14.2). Comparison/policy lives in day-script.
Source§

fn find_by_id(&self, id: &str) -> Option<RNode>

Source§

fn snapshot(&mut self) -> Result<Vec<u8>, String>

Source§

fn ui_idle(&mut self) -> bool

Whether native transitions have settled (see Toolkit::ui_idle).
Source§

fn root_node(&self) -> RNode

Source§

fn open_window_root( &mut self, options: &WindowOptions, kind: WindowKind, ) -> WindowRootReply

Open a native window and adopt its content container as an additional boundary root. Inserts the root record, asks Toolkit::open_window, and answers per the toolkit’s reply: Open(root) = live now (handle installed, window entry pushed), Pending(root) = native creation is in flight (the record is parked without a handle until Self::adopt_window_root), Unsupported = the placeholder was removed again — present the content as a cover instead.
Source§

fn adopt_window_root(&mut self, root: RNode, raw: RawHandle, size: Size) -> bool

Complete a Pending open: adopt raw as the window’s content container, install it on the parked root, and start laying out at size. false = the root is gone (closed before completion) — the caller should drop the native window again.
Source§

fn remove_window_root(&mut self, root: RNode)

Remove an (already childless) window root: bookkeeping + handle release + window entry removal. Never the primary. Idempotent; also valid for a parked Pending root.
Source§

fn set_root_size(&mut self, root: RNode, s: Size)

A secondary window’s content size changed (its WindowResized handler).
Source§

fn add_extra_layout_root(&mut self, node: RNode, size: Size)

Register an EXTRA layout root: a node that stays attached in the tree (native re-homing needs the parent link) but lays out independently at its own reported size — the cover-fallback surface (docs/windows.md). The primary root’s PassThrough layout only descends into its first child, so a second top-level surface must drive its own layout entry. set_root_size resizes it; drop it before subtree removal.
Source§

fn drop_extra_layout_root(&mut self, node: RNode)

Unregister an extra layout root (the entry only — the node itself is removed by the ordinary remove_subtree).
Source§

fn close_native_window(&mut self, root: RNode)

Ask the platform to close the window whose root is root (async — the platform confirms with Event::WindowClosed).
Source§

fn focus_native_window(&mut self, root: RNode)

Bring the window whose root is root to front and make it key.
Source§

fn set_native_window_title(&mut self, root: RNode, title: &str)

Retitle the window whose root is root.
Source§

fn snapshot_of(&mut self, root: RNode) -> Result<Vec<u8>, String>

Snapshot the window whose root is root (the primary answers snapshot).
Source§

fn install_list(&mut self, node: RNode, driver: ListDriver)

Source§

fn list_prepare_cell( &mut self, node: RNode, key: usize, cell: RawHandle, ) -> CellStep

Decide whether row key’s cell must be built (returns a fresh anchor) or rebound.
Source§

fn list_store_cell( &mut self, node: RNode, key: usize, anchor: RNode, built: BuiltRow, )

Record a freshly built row for a cell.
Source§

fn list_layout_cell(&mut self, node: RNode, key: usize)

Lay the row out inside its cell bounds (row content width × the RowHeight).
Source§

fn list_cell_keys(&self, node: RNode) -> Vec<usize>

The physical-cell keys of every bound cell of the list at node (for a bulk re-layout after the list’s own width changed).
Source§

fn list_reload(&mut self, node: RNode)

Apply a data change: the native host re-queries the source.
Source§

fn list_scroll_to_end(&mut self, node: RNode)

Imperatively scroll the native list so its last row is fully visible (no-op if empty).
Source§

fn list_scroll_to_row(&mut self, node: RNode, row: usize)

Imperatively scroll the native list so row row is visible (clamped; no-op if empty).
Source§

fn list_set_selected(&mut self, node: RNode, rows: Vec<usize>)

Programmatically sync the list’s selected rows (empty = clear). The toolkit applies without re-emitting a selection event.
Source§

fn list_driver(&mut self, node: RNode) -> Option<Rc<ListDriver>>

The list’s driver, for the guard → commit path list_try_reorder runs outside the borrow (None when node hosts no list).

Auto Trait Implementations§

§

impl<B> Freeze for Tree<B>
where B: Freeze,

§

impl<B> !RefUnwindSafe for Tree<B>

§

impl<B> !Send for Tree<B>

§

impl<B> !Sync for Tree<B>

§

impl<B> Unpin for Tree<B>
where B: Unpin, <B as Toolkit>::Handle: Unpin,

§

impl<B> UnsafeUnpin for Tree<B>
where B: UnsafeUnpin,

§

impl<B> !UnwindSafe for Tree<B>

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> 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 = 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.
§

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

Day API ↩ Guides· daybrite.dev