don't-box-scopestates
This commit is contained in:
1 parent
75f1dc76ef
commit
ba79d4babd
3 files changed
+6
-6
No files matched your search
@@ -99,7 +99,7 @@ impl VirtualDom {
|
|||||||
self.ensure_drop_safety(id);
|
self.ensure_drop_safety(id);
|
||||||
|
|
||||||
if recursive {
|
if recursive {
|
||||||
if let Some(root) = self.scopes[id.0].as_ref().try_root_node() {
|
if let Some(root) = self.scopes[id.0].try_root_node() {
|
||||||
if let RenderReturn::Ready(node) = unsafe { root.extend_lifetime_ref() } {
|
if let RenderReturn::Ready(node) = unsafe { root.extend_lifetime_ref() } {
|
||||||
self.drop_scope_inner(node)
|
self.drop_scope_inner(node)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ impl VirtualDom {
|
|||||||
let height = unsafe { parent.map(|f| (*f).height + 1).unwrap_or(0) };
|
let height = unsafe { parent.map(|f| (*f).height + 1).unwrap_or(0) };
|
||||||
let id = ScopeId(entry.key());
|
let id = ScopeId(entry.key());
|
||||||
|
|
||||||
entry.insert(Box::new(ScopeState {
|
entry.insert(ScopeState {
|
||||||
parent,
|
parent,
|
||||||
id,
|
id,
|
||||||
height,
|
height,
|
||||||
@@ -44,13 +44,13 @@ impl VirtualDom {
|
|||||||
shared_contexts: Default::default(),
|
shared_contexts: Default::default(),
|
||||||
borrowed_props: Default::default(),
|
borrowed_props: Default::default(),
|
||||||
attributes_to_drop: Default::default(),
|
attributes_to_drop: Default::default(),
|
||||||
}))
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn acquire_current_scope_raw(&self) -> Option<*const ScopeState> {
|
fn acquire_current_scope_raw(&self) -> Option<*const ScopeState> {
|
||||||
let id = self.scope_stack.last().copied()?;
|
let id = self.scope_stack.last().copied()?;
|
||||||
let scope = self.scopes.get(id.0)?;
|
let scope = self.scopes.get(id.0)?;
|
||||||
Some(scope.as_ref())
|
Some(scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn run_scope(&mut self, scope_id: ScopeId) -> &RenderReturn {
|
pub(crate) fn run_scope(&mut self, scope_id: ScopeId) -> &RenderReturn {
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ use std::{any::Any, borrow::BorrowMut, cell::Cell, collections::BTreeSet, future
|
|||||||
pub struct VirtualDom {
|
pub struct VirtualDom {
|
||||||
// Maps a template path to a map of byteindexes to templates
|
// Maps a template path to a map of byteindexes to templates
|
||||||
pub(crate) templates: FxHashMap<TemplateId, FxHashMap<usize, Template<'static>>>,
|
pub(crate) templates: FxHashMap<TemplateId, FxHashMap<usize, Template<'static>>>,
|
||||||
pub(crate) scopes: Slab<Box<ScopeState>>,
|
pub(crate) scopes: Slab<ScopeState>,
|
||||||
pub(crate) dirty_scopes: BTreeSet<DirtyScope>,
|
pub(crate) dirty_scopes: BTreeSet<DirtyScope>,
|
||||||
pub(crate) scheduler: Rc<Scheduler>,
|
pub(crate) scheduler: Rc<Scheduler>,
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ impl VirtualDom {
|
|||||||
///
|
///
|
||||||
/// This is useful for inserting or removing contexts from a scope, or rendering out its root node
|
/// This is useful for inserting or removing contexts from a scope, or rendering out its root node
|
||||||
pub fn get_scope(&self, id: ScopeId) -> Option<&ScopeState> {
|
pub fn get_scope(&self, id: ScopeId) -> Option<&ScopeState> {
|
||||||
self.scopes.get(id.0).map(|f| f.as_ref())
|
self.scopes.get(id.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the single scope at the top of the VirtualDom tree that will always be around
|
/// Get the single scope at the top of the VirtualDom tree that will always be around
|
||||||
|
|||||||
Reference in new issue
Block a user