dioxus/packages/core/src/garbage.rs
2022-11-08 19:39:37 -08:00

27 lines
778 B
Rust

use crate::{nodes::VNode, scopes::ScopeId, virtual_dom::VirtualDom, DynamicNode};
impl VirtualDom {
pub fn drop_scope(&mut self, id: ScopeId) {
let scope = self.scopes.get(id.0).unwrap();
let root = scope.root_node();
let root = unsafe { std::mem::transmute(root) };
self.drop_template(root);
}
pub fn drop_template<'a>(&'a mut self, template: &'a VNode<'a>) {
for node in template.dynamic_nodes.iter() {
match node {
DynamicNode::Text { id, .. } => {}
DynamicNode::Component { .. } => {
todo!()
}
DynamicNode::Fragment(children) => {}
DynamicNode::Placeholder(_) => todo!(),
}
}
}
}