Skip to main content

Node

Enum Node 

Source
pub enum Node {
Show 17 variants Stack { style: StackStyle, children: Nodes, scrolls: bool, }, Label { text: Rc<Dynamic>, style: LabelStyle, }, Button { title: Rc<Dynamic>, style: ButtonStyle, icon: Icon, selected: Option<Rc<Dynamic>>, action: Block, }, TextField { value: Rc<Binding>, placeholder: String, lines: u32, action: Option<Block>, }, Checkbox { checked: Rc<Binding>, title: Option<Rc<Dynamic>>, style: ToggleStyle, }, Slider { value: Rc<Binding>, min: i64, max: i64, }, Picker { selection: Rc<Binding>, options: Rc<Dynamic>, deps: StateSet, }, NavItem(NavItem), Image { path: Rc<Dynamic>, size: ImageSize, }, Progress { value: Option<Rc<Dynamic>>, }, Spacer, Divider, ContextMenu { entries: Vec<MenuEntry<Block>>, }, DropTarget { dropped: Rc<Binding>, action: Option<Block>, }, If { branches: Vec<(Rc<Expr>, Nodes)>, otherwise: Nodes, deps: StateSet, }, For { head: Rc<Loop>, body: Nodes, deps: StateSet, }, View { view: ViewId, args: Rc<[Expr]>, deps: StateSet, },
}
Expand description

UI parts are shared, so whatever runs the program can keep them for as long as it shows them.

Variants§

§

Stack

A column or row, or, when it scrolls, a scroll area.

Fields

§children: Nodes
§scrolls: bool
§

Label

Fields

§text: Rc<Dynamic>
§

Button

Shown as selected while selected holds, when it has one.

Fields

§title: Rc<Dynamic>
§icon: Icon
§selected: Option<Rc<Dynamic>>
§action: Block
§

TextField

Edits text on one line, or wraps it over lines lines and scrolls it. A one-line field with an action runs it on Return.

Fields

§value: Rc<Binding>
§placeholder: String
§lines: u32
§action: Option<Block>
§

Checkbox

A checkbox, or a switch, by its style.

Fields

§checked: Rc<Binding>
§

Slider

Picks a whole number from min to max.

Fields

§value: Rc<Binding>
§min: i64
§max: i64
§

Picker

Picks one of options into selection.

Fields

§selection: Rc<Binding>
§options: Rc<Dynamic>
§deps: StateSet

What it shows depends on: its options and its selection.

§

NavItem(NavItem)

§

Image

The image in the file at path, shown at size.

Fields

§path: Rc<Dynamic>
§

Progress

A progress bar showing value percent done, or that work is under way when it has no value.

Fields

§

Spacer

§

Divider

§

ContextMenu

A menu shown when the stack it is in is right-clicked.

Fields

§entries: Vec<MenuEntry<Block>>
§

DropTarget

Takes files and links dropped on the stack it is in: writes their paths and addresses to dropped, then runs action, if it has one.

Fields

§dropped: Rc<Binding>
§action: Option<Block>
§

If

Rebuilt when deps change; the first branch whose condition holds is shown.

Fields

§branches: Vec<(Rc<Expr>, Nodes)>
§otherwise: Nodes
§

For

Rebuilt when deps change; body is shown once per element.

Fields

§head: Rc<Loop>
§body: Nodes
§

View

Rebuilt when deps change; the arguments fill the view’s parameters.

Fields

§view: ViewId
§args: Rc<[Expr]>

Trait Implementations§

Source§

impl Debug for Node

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Send for Node

§

impl !Sync for Node

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

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, 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.