Struct dioxus_core::prelude::VNode
source · pub struct VNode<'a> {
pub key: Option<&'a str>,
pub parent: Option<ElementId>,
pub template: Cell<Template<'static>>,
pub root_ids: RefCell<Vec<'a, ElementId>>,
pub dynamic_nodes: &'a [DynamicNode<'a>],
pub dynamic_attrs: &'a [Attribute<'a>],
}
Expand description
A reference to a template along with any context needed to hydrate it
The dynamic parts of the template are stored separately from the static parts. This allows faster diffing by skipping static parts of the template.
Fields§
§key: Option<&'a str>
The key given to the root of this template.
In fragments, this is the key of the first child. In other cases, it is the key of the root.
parent: Option<ElementId>
When rendered, this template will be linked to its parent manually
template: Cell<Template<'static>>
The static nodes and static descriptor of the template
root_ids: RefCell<Vec<'a, ElementId>>
The IDs for the roots of this template - to be used when moving the template around and removing it from the actual Dom
dynamic_nodes: &'a [DynamicNode<'a>]
The dynamic parts of the template
dynamic_attrs: &'a [Attribute<'a>]
The dynamic parts of the template
Implementations§
source§impl<'a> VNode<'a>
impl<'a> VNode<'a>
sourcepub fn empty(cx: &'a ScopeState) -> Element<'a>
pub fn empty(cx: &'a ScopeState) -> Element<'a>
Create a template with no nodes that will be skipped over during diffing
sourcepub fn dynamic_root(&self, idx: usize) -> Option<&'a DynamicNode<'a>>
pub fn dynamic_root(&self, idx: usize) -> Option<&'a DynamicNode<'a>>
Load a dynamic root at the given index
Returns None
if the root is actually a static node (Element/Text)