Enum dioxus_core::TemplateNode
source · pub enum TemplateNode {
Element {
tag: &'static str,
namespace: Option<&'static str>,
attrs: &'static [TemplateAttribute],
children: &'static [TemplateNode],
},
Text {
text: &'static 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
An statically known element in the dom.
In HTML this would be something like <div id="123"> </div>
Fields
namespace: Option<&'static 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: &'static [TemplateAttribute]
A list of possibly dynamic attributes for this element
An attribute on a DOM node, such as id="my-thing"
or href="https://example.com"
.
children: &'static [TemplateNode]
A list of template nodes that define another set of template nodes
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
Implementations§
source§impl TemplateNode
impl TemplateNode
sourcepub fn dynamic_id(&self) -> Option<usize>
pub fn dynamic_id(&self) -> Option<usize>
Try to load the dynamic node at the given index
Trait Implementations§
source§impl Clone for TemplateNode
impl Clone for TemplateNode
source§fn clone(&self) -> TemplateNode
fn clone(&self) -> TemplateNode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TemplateNode
impl Debug for TemplateNode
source§impl Hash for TemplateNode
impl Hash for TemplateNode
source§impl Ord for TemplateNode
impl Ord for TemplateNode
source§fn cmp(&self, other: &TemplateNode) -> Ordering
fn cmp(&self, other: &TemplateNode) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for TemplateNode
impl PartialEq for TemplateNode
source§fn eq(&self, other: &TemplateNode) -> bool
fn eq(&self, other: &TemplateNode) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for TemplateNode
impl PartialOrd for TemplateNode
source§fn partial_cmp(&self, other: &TemplateNode) -> Option<Ordering>
fn partial_cmp(&self, other: &TemplateNode) -> 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