pub(crate) fn remove_nodes(
        &mut self,
        nodes: impl IntoIterator<Item = &'bump VNode<'bump>>,
        gen_muts: bool,
    ) {
        // or cache the vec on the diff machine
        for node in nodes {
            match node {
                VNode::Text(t) => {
                    // this check exists because our null node will be removed but does not have an ID
                    if let Some(id) = t.id.get() {
                        self.scopes.collect_garbage(id);

                        if gen_muts {
                            self.mutations.remove(id.as_u64());
                        }
                    }
                }
                VNode::Placeholder(a) => {
                    let id = a.id.get().unwrap();
                    self.scopes.collect_garbage(id);

                    if gen_muts {
                        self.mutations.remove(id.as_u64());
                    }
                }
                VNode::Element(e) => {
                    let id = e.id.get().unwrap();

                    if gen_muts {
                        self.mutations.remove(id.as_u64());
                    }

                    self.remove_nodes(e.children, false);
                }

                VNode::Fragment(f) => {
                    self.remove_nodes(f.children, gen_muts);
                }

                VNode::Component(c) => {
                    let scope_id = c.scope.get().unwrap();
                    let root = self.scopes.root_node(scope_id);
                    self.remove_nodes(Some(root), gen_muts);

                    // we can only remove this node if the originator is actively
                    if self.stack.scope_stack.contains(&c.originator) {
                        self.scopes.try_remove(scope_id).unwrap();
                    }
                }
            }
        }
    }
/// schedules nodes for garbage collection and pushes "remove" to the mutation stack
/// remove can happen whenever
schedules nodes for garbage collection and pushes "remove" to the mutation stack
remove can happen whenever
schedules nodes for garbage collection and pushes " remove " to the mutation stack remove can happen whenever
pub(crate) fn remove_nodes(
        &mut self,
        nodes: impl IntoIterator<Item = &'bump VNode<'bump>>,
        gen_muts: bool,
    ) {
        // or cache the vec on the diff machine
        for node in nodes {
            match node {
                VNode::Text(t) => {
                    // this check exists because our null node will be removed but does not have an ID
                    if let Some(id) = t.id.get() {
                        self.scopes.collect_garbage(id);
                        if gen_muts {
                            self.mutations.remove(id.as_u64());
                        }
                    }
                }
                VNode::Placeholder(a) => {
                    let id = a.id.get().unwrap();
                    self.scopes.collect_garbage(id);
                    if gen_muts {
                        self.mutations.remove(id.as_u64());
                    }
                }
                VNode::Element(e) => {
                    let id = e.id.get().unwrap();
                    if gen_muts {
                        self.mutations.remove(id.as_u64());
                    }
                    self.remove_nodes(e.children, false);
                }
                VNode::Fragment(f) => {
                    self.remove_nodes(f.children, gen_muts);
                }
                VNode::Component(c) => {
                    let scope_id = c.scope.get().unwrap();
                    let root = self.scopes.root_node(scope_id);
                    self.remove_nodes(Some(root), gen_muts);
                    // we can only remove this node if the originator is actively
                    if self.stack.scope_stack.contains(&c.originator) {
                        self.scopes.try_remove(scope_id).unwrap();
                    }
                }
            }
        }
    }
pub ( crate ) fn remove_nodes ( & mut self , nodes : impl IntoIterator < Item = & ' bump VNode < ' bump > > , gen_muts : bool , ) { // or cache the vec on the diff machine for node in nodes { match node { VNode :: Text ( t ) => { // this check exists because our null node will be removed but does not have an ID if let Some ( id ) = t . id . get ( ) { self . scopes . collect_garbage ( id ) ; if gen_muts { self . mutations . remove ( id . as_u64 ( ) ) ; } } } VNode :: Placeholder ( a ) => { let id = a . id . get ( ) . unwrap ( ) ; self . scopes . collect_garbage ( id ) ; if gen_muts { self . mutations . remove ( id . as_u64 ( ) ) ; } } VNode :: Element ( e ) => { let id = e . id . get ( ) . unwrap ( ) ; if gen_muts { self . mutations . remove ( id . as_u64 ( ) ) ; } self . remove_nodes ( e . children , false ) ; } VNode :: Fragment ( f ) => { self . remove_nodes ( f . children , gen_muts ) ; } VNode :: Component ( c ) => { let scope_id = c . scope . get ( ) . unwrap ( ) ; let root = self . scopes . root_node ( scope_id ) ; self . remove_nodes ( Some ( root ) , gen_muts ) ; // we can only remove this node if the originator is actively if self . stack . scope_stack . contains ( & c . originator ) { self . scopes . try_remove ( scope_id ) . unwrap ( ) ; } } } } }
schedules nodes for garbage collection and pushes "remove" to the mutation stack
remove can happen whenever
schedules nodes for garbage collection and pushes " remove " to the mutation stack remove can happen whenever
&mut self
nodes
impl IntoIterator<Item = &'bump VNode<'bump>>
gen_muts
bool