[−][src]Enum sauron_vdom::Node
This is the core data structure of the library.
Any tree can be represented by Node
.
The T
is generic instead of just using plain &'static str
in order for this library to be used not only in html based widget
but can also be used to represent native GUI widgets
in various platforms.
Note: Clone is necessary for the aesthetics in the construction of node through series of function calls. Without Clone, the user code would look like these:
div(&[class("some-class"), &[text("Some text")])
as compared to
div([class("some-class"), [text("some text)])
Cloning is only done once, and happens when constructing the views into a node tree. Cloning also allows flexibility such as adding more children into an existing node/element.
Variants
Element(Element<T, ATT, EVENT, MSG>)
Text(Text)
Methods
impl<T, ATT, EVENT, MSG> Node<T, ATT, EVENT, MSG> where
EVENT: 'static,
MSG: 'static,
ATT: PartialEq + Ord + ToString + Clone,
[src]
EVENT: 'static,
MSG: 'static,
ATT: PartialEq + Ord + ToString + Clone,
pub fn map_msg<F, MSG2>(self, func: F) -> Node<T, ATT, EVENT, MSG2> where
F: Fn(MSG) -> MSG2 + 'static,
MSG2: 'static,
[src]
F: Fn(MSG) -> MSG2 + 'static,
MSG2: 'static,
pub fn take_element(self) -> Option<Element<T, ATT, EVENT, MSG>>
[src]
consume the element
pub fn as_element_mut(&mut self) -> Option<&mut Element<T, ATT, EVENT, MSG>>
[src]
Get a mutable reference to the element
pub fn as_element_ref(&self) -> Option<&Element<T, ATT, EVENT, MSG>>
[src]
pub fn add_children(self, children: Vec<Node<T, ATT, EVENT, MSG>>) -> Self
[src]
Append children to this element
pub fn add_attributes(self, attributes: Vec<Attribute<ATT, EVENT, MSG>>) -> Self
[src]
add attributes to the node
pub fn get_attributes(&self) -> Vec<Attribute<ATT, EVENT, MSG>>
[src]
get the attributes of this node
Trait Implementations
impl<T: Clone, ATT: Clone, EVENT: Clone, MSG: Clone> Clone for Node<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
impl<T: Debug, ATT: Debug, EVENT: Debug, MSG: Debug> Debug for Node<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
impl<T, ATT, EVENT, MSG> Display for Node<T, ATT, EVENT, MSG> where
T: ToString,
EVENT: 'static,
MSG: 'static,
ATT: PartialEq + Ord + ToString + Clone,
[src]
T: ToString,
EVENT: 'static,
MSG: 'static,
ATT: PartialEq + Ord + ToString + Clone,
impl<T, ATT, EVENT, MSG> From<Element<T, ATT, EVENT, MSG>> for Node<T, ATT, EVENT, MSG> where
ATT: Clone,
[src]
ATT: Clone,
impl<T: PartialEq, ATT: PartialEq, EVENT: PartialEq, MSG: PartialEq> PartialEq<Node<T, ATT, EVENT, MSG>> for Node<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
fn eq(&self, other: &Node<T, ATT, EVENT, MSG>) -> bool
[src]
fn ne(&self, other: &Node<T, ATT, EVENT, MSG>) -> bool
[src]
impl<T, ATT, EVENT, MSG> StructuralPartialEq for Node<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
Auto Trait Implementations
impl<T, ATT, EVENT, MSG> !RefUnwindSafe for Node<T, ATT, EVENT, MSG>
impl<T, ATT, EVENT, MSG> !Send for Node<T, ATT, EVENT, MSG>
impl<T, ATT, EVENT, MSG> !Sync for Node<T, ATT, EVENT, MSG>
impl<T, ATT, EVENT, MSG> Unpin for Node<T, ATT, EVENT, MSG> where
ATT: Unpin,
T: Unpin,
ATT: Unpin,
T: Unpin,
impl<T, ATT, EVENT, MSG> !UnwindSafe for Node<T, ATT, 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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,