Skip to main content

Node

Struct Node 

Source
pub struct Node<M>(/* private fields */);
Expand description

A piece of UI. Build it with the functions in this module.

Implementations§

Source§

impl<M> Node<M>

Source

pub fn tone(self, tone: Tone) -> Self

Sets the tone of this text, or of every text inside this node that has none yet.

Source

pub fn on_hover(self, index: usize) -> Self

For an alternate: shows the option at index while the pointer is over the item, whatever current is. Other nodes have nothing to show on hover and ignore it.

Source

pub fn on_secondary(self, message: M) -> Self

For a button or list_item: sent on a secondary (right) click on it. Other nodes ignore it.

Source

pub fn prominent(self) -> Self

For a button: the main action of its page, filled so it stands out. Other nodes ignore it.

Source

pub fn on_press(self, message: M) -> Self

For a list_item: sent on a click on it. Other nodes ignore it.

Source

pub fn subtitle(self, text: impl Into<String>) -> Self

For a list_item: a second, dimmer line under the title. Other nodes ignore it.

Source

pub fn leading(self, node: Node<M>) -> Self

For a list_item: an icon before the title. Other nodes ignore it.

Source

pub fn trailing(self, node: Node<M>) -> Self

For a list_item, section, header, text_input or text_area: a node at the far end, like a lock or an info button. Other nodes ignore it.

Source

pub fn selected(self, yes: bool) -> Self

For a list_item: marks it as the one in use. Other nodes ignore it.

Source

pub fn on_back(self, message: M) -> Self

For a header: shows a back button that sends message. Other nodes ignore it.

Source

pub fn step(self, by: f32) -> Self

For a slider: the step its value snaps to (1 by default). Other nodes ignore it.

Source

pub fn on_release(self, message: M) -> Self

For a slider: sent when it’s let go. Other nodes ignore it.

Source

pub fn on_submit(self, message: M) -> Self

For a text_input or text_area: sent on Enter. Other nodes ignore it.

Source

pub fn secret(self, yes: bool) -> Self

For a text_input: hides what’s typed, like a password. Other nodes ignore it.

Source

pub fn large(self) -> Self

For a cover: drawn big, as the main picture of a popover, not as an icon. Other nodes ignore it.

Source

pub fn bottom(self) -> Self

For a scroll: keeps its end in view as content arrives there, unless you’ve scrolled up to read. Other nodes ignore it.

Source

pub fn limit(self, at: f32) -> Self

For a meter: marks a limit along it (0.0 to 1.0). Other nodes ignore it.

Source

pub fn map<N: 'static>(self, f: &(impl Fn(M) -> N + Clone + 'static)) -> Node<N>
where M: 'static,

Converts every message in this node. Sliders and text fields keep f to convert the messages they make later, so it must be Clone + 'static, like a function or a closure that captures nothing.

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for Node<M>

§

impl<M> !Send for Node<M>

§

impl<M> !Sync for Node<M>

§

impl<M> !UnwindSafe for Node<M>

§

impl<M> Freeze for Node<M>
where Kind<M>: Freeze,

§

impl<M> Unpin for Node<M>
where Kind<M>: Unpin,

§

impl<M> UnsafeUnpin for Node<M>
where Kind<M>: UnsafeUnpin,

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

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.