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 variant of a virtual node
Tuple Fields of Element
0: Element<NS, TAG, ATT, VAL, EVENT>
Text variant of a virtual node
Tuple Fields of Text
0: Text
Implementations
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
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
Trait Implementations
impl<NS: PartialEq, TAG: PartialEq, ATT: PartialEq, VAL: PartialEq, EVENT: PartialEq> PartialEq<Node<NS, TAG, ATT, VAL, EVENT>> for 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,
impl<NS: PartialEq, TAG: PartialEq, ATT: PartialEq, VAL: PartialEq, EVENT: PartialEq> PartialEq<Node<NS, TAG, ATT, VAL, EVENT>> for 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,
Auto Trait Implementations
impl<NS, TAG, ATT, VAL, EVENT> RefUnwindSafe for Node<NS, TAG, ATT, VAL, EVENT> where
ATT: RefUnwindSafe,
EVENT: RefUnwindSafe,
NS: RefUnwindSafe,
TAG: RefUnwindSafe,
VAL: RefUnwindSafe,
impl<NS, TAG, ATT, VAL, EVENT> Send for Node<NS, TAG, ATT, VAL, EVENT> where
ATT: Send,
EVENT: Send,
NS: Send,
TAG: Send,
VAL: Send,
impl<NS, TAG, ATT, VAL, EVENT> Sync for Node<NS, TAG, ATT, VAL, EVENT> where
ATT: Sync,
EVENT: Sync,
NS: Sync,
TAG: Sync,
VAL: Sync,
impl<NS, TAG, ATT, VAL, EVENT> Unpin for Node<NS, TAG, ATT, VAL, EVENT> where
ATT: Unpin,
EVENT: Unpin,
NS: Unpin,
TAG: Unpin,
VAL: Unpin,
impl<NS, TAG, ATT, VAL, EVENT> UnwindSafe for Node<NS, TAG, ATT, VAL, EVENT> where
ATT: UnwindSafe,
EVENT: UnwindSafe,
NS: UnwindSafe,
TAG: UnwindSafe,
VAL: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more