Enum Node

Source
pub enum Node<Ms> {
    Element(El<Ms>),
    Text(Text),
    Empty,
    NoChange,
}
Expand description

A component in our virtual DOM. MDN reference web_sys reference

Variants§

§

Element(El<Ms>)

§

Text(Text)

§

Empty

§

NoChange

Implementations§

Source§

impl<Ms> Node<Ms>

Source

pub fn from_html(namespace: Option<&Namespace>, html: &str) -> Vec<Node<Ms>>

See El::from_html

Source

pub fn add_child(&mut self, node: Node<Ms>) -> &mut Self

See El::add_child

Source

pub fn add_attr( &mut self, key: impl Into<Cow<'static, str>>, val: impl Into<AtValue>, ) -> &mut Self

See El::add_attr

Source

pub fn add_class(&mut self, name: impl Into<Cow<'static, str>>) -> &mut Self

See El::add_class

Source

pub fn add_style( &mut self, key: impl Into<St>, val: impl Into<CSSValue>, ) -> &mut Self

See El::add_style

Source

pub fn add_event_handler( &mut self, event_handler: EventHandler<Ms>, ) -> &mut Self

See El::add_event_handler

Source

pub fn add_text(&mut self, text: impl Into<Cow<'static, str>>) -> &mut Self

See El::add_text

Source

pub fn replace_text(&mut self, text: impl Into<Cow<'static, str>>) -> &mut Self

See El::replace_text

Source

pub fn get_text(&self) -> String

See El::get_text

Source

pub fn el_key(&self) -> Option<&ElKey>

Retrive key attached to the El

Source§

impl<Ms> Node<Ms>

Source

pub fn new_text(text: impl Into<Cow<'static, str>>) -> Self

Source

pub const fn is_text(&self) -> bool

Source

pub const fn is_el(&self) -> bool

Source

pub const fn is_empty(&self) -> bool

Source

pub const fn text(&self) -> Option<&Text>

Source

pub const fn el(&self) -> Option<&El<Ms>>

Source§

impl<Ms> Node<Ms>

Trait Implementations§

Source§

impl<Ms> Clone for Node<Ms>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Ms: Debug> Debug for Node<Ms>

Source§

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

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

impl<Ms> Display for Node<Ms>

Source§

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

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

impl<Ms> From<&Element> for Node<Ms>

Source§

fn from(ws_el: &Element) -> Node<Ms>

Converts to this type from the input type.
Source§

impl<Ms> IntoNodes<Ms> for Node<Ms>

Source§

fn into_nodes(self) -> Vec<Node<Ms>>

Converts item or items to Vec<Node<Ms>.
Source§

impl<Ms: 'static, OtherMs: 'static> MessageMapper<Ms, OtherMs> for Node<Ms>

Source§

fn map_msg( self, f: impl FnOnce(Ms) -> OtherMs + 'static + Clone, ) -> Node<OtherMs>

See note on impl for El

Source§

type SelfWithOtherMs = Node<OtherMs>

Source§

impl<Ms> UpdateEl<Ms> for Node<Ms>

Source§

fn update_el(self, el: &mut El<Ms>)

Source§

impl<Ms> View<Ms> for Node<Ms>

Source§

fn els(self) -> Vec<Node<Ms>>

👎Deprecated since 0.7.0: Use IntoNodes instead.

Auto Trait Implementations§

§

impl<Ms> Freeze for Node<Ms>

§

impl<Ms> !RefUnwindSafe for Node<Ms>

§

impl<Ms> !Send for Node<Ms>

§

impl<Ms> !Sync for Node<Ms>

§

impl<Ms> Unpin for Node<Ms>

§

impl<Ms> !UnwindSafe for Node<Ms>

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V