[][src]Enum sauron_vdom::Node

pub enum Node<T> {
    Element(Element<T>),
    Text(Text),
}

When building your views you'll typically use the html! macro to generate VirtualNode's.

html! { <div> <span></span> </div> } really generates a VirtualNode with one child (span).

Later, on the client side, you'll use the diff and patch modules to update the real DOM with your latest tree of virtual nodes (virtual dom).

Or on the server side you'll just call .to_string() on your root virtual node in order to recursively render the node and all of its children.

TODO: Make all of these fields private and create accessor methods TODO: Create a builder to create instances of VirtualNode::Element with attrs and children without having to explicitly create a Element

Variants

Element(Element<T>)Text(Text)

Methods

impl<T> Node<T> where
    T: Clone
[src]

pub fn as_element(&mut self) -> Option<&mut Element<T>>[src]

pub fn children<C>(self, children: C) -> Self where
    C: AsRef<[Node<T>]>, 
[src]

Append children to this element

pub fn attributes<'a, A>(self, attributes: A) -> Self where
    A: AsRef<[Attribute<'a>]>, 
[src]

add attributes to the node

Trait Implementations

impl<T: PartialEq> PartialEq<Node<T>> for Node<T>[src]

impl<T: Clone> Clone for Node<T>[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T> From<Element<T>> for Node<T>[src]

impl<T: Debug> Debug for Node<T>[src]

impl<T> Display for Node<T> where
    T: ToString
[src]

Auto Trait Implementations

impl<T> !Send for Node<T>

impl<T> !Sync for Node<T>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.