Skip to main content

Command

Enum Command 

Source
pub enum Command {
Show 13 variants Create { id: NodeId, kind: WidgetKind, props: Vec<Prop>, }, SetProp { id: NodeId, prop: Prop, }, Insert { parent: NodeId, child: NodeId, index: usize, }, Remove { parent: NodeId, child: NodeId, }, Destroy { id: NodeId, }, SetFrame { id: NodeId, frame: Rect, }, SetA11y { id: NodeId, a11y: A11yProps, }, SetWindowSize { id: NodeId, size: Size, }, SetFocusOrder { window: NodeId, order: Vec<NodeId>, }, ScrollTo { id: NodeId, offset: Point, }, Focus { id: NodeId, }, SelectText { id: NodeId, range: Range<usize>, }, ScrollToRow { id: NodeId, row: RowKey, },
}
Expand description

A change the backend must apply to the native widget tree.

Commands arrive in batches. Within a batch, order matters: a node is always created before it is inserted, and a subtree root is removed before it is destroyed.

Variants§

§

Create

Native views start with a zero frame; the core only sends frames that differ from the last one it sent.

Fields

§props: Vec<Prop>
§

SetProp

Fields

§prop: Prop
§

Insert

Fields

§parent: NodeId
§child: NodeId
§index: usize
§

Remove

Fields

§parent: NodeId
§child: NodeId
§

Destroy

Frees a node. Sent for every native node of a destroyed subtree, children first. The subtree’s root has already been removed from its parent; nodes inside it may still be attached to each other.

Fields

§

SetFrame

Parent-relative, logical units. Never sent for windows.

Fields

§frame: Rect
§

SetA11y

Fields

§

SetWindowSize

Window content size requested by the app. The platform may refuse it (a window in full screen keeps the screen’s), or give it no smaller than the window’s MinSize; it reports the size it gives as WindowResized.

Fields

§size: Size
§

SetFocusOrder

The keyboard (Tab) order of a window’s focusable controls. Sent when it changes. Backends chain focus in this order; which controls can actually take focus stays a platform decision (e.g. macOS keyboard navigation settings).

Fields

§window: NodeId
§order: Vec<NodeId>
§

ScrollTo

Scrolls a ScrollView or List so offset (content coordinates) is at its top-left. Already clamped by the core. Like user scrolling, it makes the backend report Scrolled.

Fields

§offset: Point
§

Focus

Fields

§

SelectText

Selects these characters of a text field’s or text area’s text, counted in Unicode scalar values, within it and on grapheme boundaries (the app counts graphemes). A Focus for the field comes first in the batch: a selection is the focused field’s.

Fields

§range: Range<usize>
§

ScrollToRow

Scrolls a List or Table just enough to show a row, as the platform’s own “scroll to row” does. The platform then reports Scrolled, and the rows it shows.

Fields

Trait Implementations§

Source§

impl Clone for Command

Source§

fn clone(&self) -> Self

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
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Command

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Command

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> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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 = !

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.