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§
§impl<'a> VNode<'a>
impl<'a> VNode<'a>
pub fn empty(cx: &'a ScopeState) -> Option<VNode<'a>>
pub fn empty(cx: &'a ScopeState) -> Option<VNode<'a>>
Create a template with no nodes that will be skipped over during diffing
pub 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)
Trait Implementations§
§impl<'a> IntoDynNode<'a, ()> for &'a VNode<'a>
impl<'a> IntoDynNode<'a, ()> for &'a VNode<'a>
§fn into_vnode(self, _cx: &'a ScopeState) -> DynamicNode<'a>
fn into_vnode(self, _cx: &'a ScopeState) -> DynamicNode<'a>
§impl<'a> IntoDynNode<'a, ()> for VNode<'a>
impl<'a> IntoDynNode<'a, ()> for VNode<'a>
§fn into_vnode(self, _cx: &'a ScopeState) -> DynamicNode<'a>
fn into_vnode(self, _cx: &'a ScopeState) -> DynamicNode<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for VNode<'a>
impl<'a> !Send for VNode<'a>
impl<'a> !Sync for VNode<'a>
impl<'a> Unpin for VNode<'a>
impl<'a> !UnwindSafe for VNode<'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.