Enum dioxus_core::prelude::TemplateNode
source · pub enum TemplateNode<'a> {
Element {
tag: &'a str,
namespace: Option<&'a str>,
attrs: &'a [TemplateAttribute<'a>],
children: &'a [TemplateNode<'a>],
},
Text {
text: &'a str,
},
Dynamic {
id: usize,
},
DynamicText {
id: usize,
},
}
Expand description
A statically known node in a layout.
This can be created at compile time, saving the VirtualDom time when diffing the tree
Variants§
Element
Fields
namespace: Option<&'a str>
The namespace of the element
In HTML, this would be a valid URI that defines a namespace for all elements below it SVG is an example of this namespace
attrs: &'a [TemplateAttribute<'a>]
A list of possibly dynamic attribues for this element
An attribute on a DOM node, such as id="my-thing"
or href="https://example.com"
.
children: &'a [TemplateNode<'a>]
A list of template nodes that define another set of template nodes
An statically known element in the dom.
In HTML this would be something like <div id="123"> </div>
Text
This template node is just a piece of static text
Dynamic
This template node is unknown, and needs to be created at runtime.
DynamicText
This template node is known to be some text, but needs to be created at runtime
This is separate from the pure Dynamic variant for various optimizations
Trait Implementations§
source§impl<'a> Clone for TemplateNode<'a>
impl<'a> Clone for TemplateNode<'a>
source§fn clone(&self) -> TemplateNode<'a>
fn clone(&self) -> TemplateNode<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for TemplateNode<'a>
impl<'a> Debug for TemplateNode<'a>
source§impl<'de: 'a, 'a> Deserialize<'de> for TemplateNode<'a>
impl<'de: 'a, 'a> Deserialize<'de> for TemplateNode<'a>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl<'a> Hash for TemplateNode<'a>
impl<'a> Hash for TemplateNode<'a>
source§impl<'a> Ord for TemplateNode<'a>
impl<'a> Ord for TemplateNode<'a>
source§fn cmp(&self, other: &TemplateNode<'a>) -> Ordering
fn cmp(&self, other: &TemplateNode<'a>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<'a> PartialEq<TemplateNode<'a>> for TemplateNode<'a>
impl<'a> PartialEq<TemplateNode<'a>> for TemplateNode<'a>
source§fn eq(&self, other: &TemplateNode<'a>) -> bool
fn eq(&self, other: &TemplateNode<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<'a> PartialOrd<TemplateNode<'a>> for TemplateNode<'a>
impl<'a> PartialOrd<TemplateNode<'a>> for TemplateNode<'a>
source§fn partial_cmp(&self, other: &TemplateNode<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &TemplateNode<'a>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more