Enum mt_dom::Node[][src]

pub enum Node<NS, TAG, ATT, VAL, EVENT> where
    NS: PartialEq + Clone + Debug,
    TAG: PartialEq + Clone + Debug,
    ATT: PartialEq + Clone + Debug,
    VAL: PartialEq + Clone + Debug,
    EVENT: PartialEq + Clone + Debug
{ Element(Element<NS, TAG, ATT, VAL, EVENT>), Text(Text), }
Expand description

represents a node in a virtual dom A node could be an element which can contain one or more children of nodes. A node could also be just a text node which contains a string

Much of the types are Generics

NS - is the type for the namespace, this will be &’static str when used in html based virtual dom implementation TAG - is the type for the element tag, this will be &’static str when used in html based virtual dom impmenentation ATT - is the type for the attribute name, this will be &’static str when used in html based virtual dom implementation VAL - is the type for the value of the attribute, this will be String, f64, or just another generics that suits the implementing library which used mt-dom for just dom-diffing purposes

Variants

Element

Element variant of a virtual node

Tuple Fields of Element

0: Element<NS, TAG, ATT, VAL, EVENT>
Text

Text variant of a virtual node

Tuple Fields of Text

0: Text

Implementations

returns true if this a text node

consume self and return the element if it is an element variant None if it is a text node

Get a mutable reference to the element, if this node is an element node

returns a reference to the element if this is an element node

Consume a mutable self and add a children to this node it if is an element will have no effect if it is a text node. This is used in building the nodes in a builder pattern

add children but not consume self

add attributes to the node and returns itself this is used in view building

add attributes using a mutable reference to self

get the attributes of this node returns None if it is a text node

returns the tag of this node if it is an element otherwise None if it is a text node

returns the text content if it is a text node

return the children of this node if it is an element returns None if it is a text node

return the children of this node if it is an element returns None if it is a text node

recursive count the number of nodes under this tree

remove the existing attributes and set with the new value

merge to existing attributes if the attribute name already exist

returh the attribute values of this node which match the attribute name name

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.