Skip to main content

NodeRef

Struct NodeRef 

Source
pub struct NodeRef<'a, Msg> { /* private fields */ }
Expand description

A chainable reference to the node most recently pushed onto a ContainerBuilder, used to set styling/events without needing a separate variable per node.

Implementations§

Source§

impl<'a, Msg> NodeRef<'a, Msg>

Source

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

Source

pub fn on_click(self, msg: Msg) -> Self

Source

pub fn on_input(self, f: impl Fn(String) -> Msg + Send + Sync + 'static) -> Self

Two-way binding for Input nodes: f is called with the input’s new value on every change, producing a Msg to dispatch. See OnInput. Currently only wired up by tpt-appfront-dom.

Source

pub fn on_toggle(self, f: impl Fn(bool) -> Msg + Send + Sync + 'static) -> Self

Two-way binding for Checkbox nodes: f is called with the checkbox’s new checked state on every change. See OnToggle.

Source

pub fn ai_action(self, action: impl Into<String>) -> Self

Source

pub fn ai_param(self, key: impl Into<String>, value: impl Into<String>) -> Self

Source

pub fn ai_description(self, desc: impl Into<String>) -> Self

Source

pub fn attr(self, name: impl Into<String>, value: impl Into<String>) -> Self

Sets an arbitrary attribute (e.g. role, tabindex, aria-*, placeholder). Rendered verbatim by backends that model HTML attributes; ignored where unsupported. See NodeMeta::attrs.

Source

pub fn aria(self, name: impl Into<String>, value: impl Into<String>) -> Self

Convenience for ARIA attributes (e.g. self.aria("label", "menu") emits aria-label="menu").

Source

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

Stable identity for reconciliation (e.g. a row/entity id) — see NodeMeta::key.

Source

pub fn virtual_scroll(self, config: VirtualScroll) -> Self

Enables windowed rendering for a List/DataGrid — see VirtualScroll.

Auto Trait Implementations§

§

impl<'a, Msg> !RefUnwindSafe for NodeRef<'a, Msg>

§

impl<'a, Msg> !UnwindSafe for NodeRef<'a, Msg>

§

impl<'a, Msg> Freeze for NodeRef<'a, Msg>

§

impl<'a, Msg> Send for NodeRef<'a, Msg>
where Msg: Send,

§

impl<'a, Msg> Sync for NodeRef<'a, Msg>
where Msg: Sync,

§

impl<'a, Msg> Unpin for NodeRef<'a, Msg>

§

impl<'a, Msg> UnsafeUnpin for NodeRef<'a, Msg>

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.