[−][src]Enum sauron_vdom::Node
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]
T: Clone,
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]
C: AsRef<[Node<T>]>,
Append children to this element
pub fn attributes<'a, A>(self, attributes: A) -> Self where
A: AsRef<[Attribute<'a>]>,
[src]
A: AsRef<[Attribute<'a>]>,
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]
fn clone(&self) -> 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]
T: ToString,
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,