Enum freya::prelude::TemplateNode
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§
§impl<'a> Clone for TemplateNode<'a>
impl<'a> Clone for TemplateNode<'a>
§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 more§impl<'a> Debug for TemplateNode<'a>
impl<'a> Debug for TemplateNode<'a>
§impl<'de, 'a> Deserialize<'de> for TemplateNode<'a>where
'de: 'a,
impl<'de, 'a> Deserialize<'de> for TemplateNode<'a>where 'de: 'a,
§fn deserialize<__D>(
__deserializer: __D
) -> Result<TemplateNode<'a>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<TemplateNode<'a>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
§impl<'a> Hash for TemplateNode<'a>
impl<'a> Hash for TemplateNode<'a>
§impl<'a> Ord for TemplateNode<'a>
impl<'a> Ord for TemplateNode<'a>
§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,
§impl<'a> PartialEq<TemplateNode<'a>> for TemplateNode<'a>
impl<'a> PartialEq<TemplateNode<'a>> for TemplateNode<'a>
§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 ==
.§impl<'a> PartialOrd<TemplateNode<'a>> for TemplateNode<'a>
impl<'a> PartialOrd<TemplateNode<'a>> for TemplateNode<'a>
§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§impl<'a> Serialize for TemplateNode<'a>
impl<'a> Serialize for TemplateNode<'a>
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
impl<'a> Copy for TemplateNode<'a>
impl<'a> Eq for TemplateNode<'a>
impl<'a> StructuralEq for TemplateNode<'a>
impl<'a> StructuralPartialEq for TemplateNode<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for TemplateNode<'a>
impl<'a> Send for TemplateNode<'a>
impl<'a> Sync for TemplateNode<'a>
impl<'a> Unpin for TemplateNode<'a>
impl<'a> UnwindSafe for TemplateNode<'a>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.