pub enum TemplateNode {
Element {
tag: &'static str,
namespace: Option<&'static str>,
attrs: &'static [TemplateAttribute],
children: &'static [TemplateNode],
},
Text {
text: &'static str,
},
Dynamic {
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.
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
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for TemplateNode
impl PartialEq for TemplateNode
source§impl PartialOrd for TemplateNode
impl PartialOrd for TemplateNode
impl Copy for TemplateNode
impl Eq for TemplateNode
impl StructuralPartialEq for TemplateNode
Auto Trait Implementations§
impl Freeze for TemplateNode
impl RefUnwindSafe for TemplateNode
impl Send for TemplateNode
impl Sync for TemplateNode
impl Unpin for TemplateNode
impl UnwindSafe for TemplateNode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.