[−][src]Enum mt_dom::Node
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<NS, TAG, ATT, VAL, EVENT, MSG>)
Element variant of a virtual node
Text(String)
Text variant of a virtual node
Implementations
impl<NS, TAG, ATT, VAL, EVENT, MSG> Node<NS, TAG, ATT, VAL, EVENT, MSG>
[src]
pub fn is_text(&self) -> bool
[src]
returns true if this a text node
pub fn take_element(self) -> Option<Element<NS, TAG, ATT, VAL, EVENT, MSG>>
[src]
consume self and return the element if it is an element variant None if it is a text node
pub fn as_element_mut(
&mut self
) -> Option<&mut Element<NS, TAG, ATT, VAL, EVENT, MSG>>
[src]
&mut self
) -> Option<&mut Element<NS, TAG, ATT, VAL, EVENT, MSG>>
Get a mutable reference to the element, if this node is an element node
pub fn as_element_ref(&self) -> Option<&Element<NS, TAG, ATT, VAL, EVENT, MSG>>
[src]
returns a reference to the element if this is an element node
pub fn add_children(
self,
children: Vec<Node<NS, TAG, ATT, VAL, EVENT, MSG>>
) -> Self
[src]
self,
children: Vec<Node<NS, TAG, ATT, VAL, EVENT, MSG>>
) -> Self
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
pub fn add_attributes(
self,
attributes: Vec<Attribute<NS, ATT, VAL, EVENT, MSG>>
) -> Self
[src]
self,
attributes: Vec<Attribute<NS, ATT, VAL, EVENT, MSG>>
) -> Self
add attributes to the node and returns itself this is used in view building
pub fn add_attributes_ref_mut(
&mut self,
attributes: Vec<Attribute<NS, ATT, VAL, EVENT, MSG>>
)
[src]
&mut self,
attributes: Vec<Attribute<NS, ATT, VAL, EVENT, MSG>>
)
add attributes using a mutable reference to self
pub fn get_attributes(&self) -> Option<&[Attribute<NS, ATT, VAL, EVENT, MSG>]>
[src]
get the attributes of this node returns None if it is a text node
pub fn tag(&self) -> Option<&TAG>
[src]
returns the tag of this node if it is an element otherwise None if it is a text node
pub fn text(&self) -> Option<&str>
[src]
returns the text content if it is a text node
pub fn get_children(&self) -> Option<&[Node<NS, TAG, ATT, VAL, EVENT, MSG>]>
[src]
return the children of this node if it is an element returns None if it is a text node
impl<NS, TAG, ATT, VAL, EVENT, MSG> Node<NS, TAG, ATT, VAL, EVENT, MSG> where
ATT: PartialEq,
[src]
ATT: PartialEq,
pub fn set_attributes_ref_mut(
&mut self,
attributes: Vec<Attribute<NS, ATT, VAL, EVENT, MSG>>
)
[src]
&mut self,
attributes: Vec<Attribute<NS, ATT, VAL, EVENT, MSG>>
)
remove the existing attributes and set with the new value
impl<NS, TAG, ATT, VAL, EVENT, MSG> Node<NS, TAG, ATT, VAL, EVENT, MSG> where
EVENT: 'static,
MSG: 'static,
[src]
EVENT: 'static,
MSG: 'static,
pub fn map_msg<F, MSG2>(self, func: F) -> Node<NS, TAG, ATT, VAL, EVENT, MSG2> where
F: Fn(MSG) -> MSG2 + 'static,
MSG2: 'static,
[src]
F: Fn(MSG) -> MSG2 + 'static,
MSG2: 'static,
map the msg of callback of this element node
pub fn map_callback<MSG2>(
self,
cb: Callback<MSG, MSG2>
) -> Node<NS, TAG, ATT, VAL, EVENT, MSG2> where
MSG2: 'static,
[src]
self,
cb: Callback<MSG, MSG2>
) -> Node<NS, TAG, ATT, VAL, EVENT, MSG2> where
MSG2: 'static,
map the msg of callback of this element node
Trait Implementations
impl<NS: Clone, TAG: Clone, ATT: Clone, VAL: Clone, EVENT: Clone, MSG: Clone> Clone for Node<NS, TAG, ATT, VAL, EVENT, MSG>
[src]
fn clone(&self) -> Node<NS, TAG, ATT, VAL, EVENT, MSG>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<NS: Debug, TAG: Debug, ATT: Debug, VAL: Debug, EVENT: Debug, MSG: Debug> Debug for Node<NS, TAG, ATT, VAL, EVENT, MSG>
[src]
impl<NS: PartialEq, TAG: PartialEq, ATT: PartialEq, VAL: PartialEq, EVENT: PartialEq, MSG: PartialEq> PartialEq<Node<NS, TAG, ATT, VAL, EVENT, MSG>> for Node<NS, TAG, ATT, VAL, EVENT, MSG>
[src]
fn eq(&self, other: &Node<NS, TAG, ATT, VAL, EVENT, MSG>) -> bool
[src]
fn ne(&self, other: &Node<NS, TAG, ATT, VAL, EVENT, MSG>) -> bool
[src]
impl<NS, TAG, ATT, VAL, EVENT, MSG> StructuralPartialEq for Node<NS, TAG, ATT, VAL, EVENT, MSG>
[src]
Auto Trait Implementations
impl<NS, TAG, ATT, VAL, EVENT, MSG> !RefUnwindSafe for Node<NS, TAG, ATT, VAL, EVENT, MSG>
impl<NS, TAG, ATT, VAL, EVENT, MSG> !Send for Node<NS, TAG, ATT, VAL, EVENT, MSG>
impl<NS, TAG, ATT, VAL, EVENT, MSG> !Sync for Node<NS, TAG, ATT, VAL, EVENT, MSG>
impl<NS, TAG, ATT, VAL, EVENT, MSG> Unpin for Node<NS, TAG, ATT, VAL, EVENT, MSG> where
ATT: Unpin,
NS: Unpin,
TAG: Unpin,
VAL: Unpin,
ATT: Unpin,
NS: Unpin,
TAG: Unpin,
VAL: Unpin,
impl<NS, TAG, ATT, VAL, EVENT, MSG> !UnwindSafe for Node<NS, TAG, ATT, VAL, EVENT, MSG>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,