pub fn delete_children(&mut self, branch_root: &K) -> Vec<ReorgNode<K, M>> {
        let mut ret: Vec<ReorgNode<K, M>> = Vec::new();
        // First we try to remove the designated node from the system
        if let Some(removed) = self.nodes_by_key.remove(branch_root) {
            // We add the removed nodes children to the list that we will remove next
            let mut removeable: Vec<K> = removed.children.clone();
            // We push the node into the list of nodes we will return
            ret.push(removed);
            // As long as there are possible nodes in this branch we repeatedly
            // remove a node, if it succeeds we push its children to
            // the list of removable nodes, then append the node to the return list.
            while !removeable.is_empty() {
                let mut remove_next = Vec::new();
                for key in &removeable {
                    if let Some(mut removed_last) = self.nodes_by_key.remove(key) {
                        remove_next.append(&mut removed_last.children);
                        ret.push(removed_last);
                    }
                }
                removeable = remove_next;
            }
        }
        ret
    }
/// This function is part of the garbage collection. Deletes every node that in the branch
/// stemming from the node we designated.
This function is part of the garbage collection. Deletes every node that in the branch
stemming from the node we designated.
This function is part of the garbage collection . Deletes every node that in the branch stemming from the node we designated .
pub fn delete_children(&mut self, branch_root: &K) -> Vec<ReorgNode<K, M>> {
        let mut ret: Vec<ReorgNode<K, M>> = Vec::new();
        // First we try to remove the designated node from the system
        if let Some(removed) = self.nodes_by_key.remove(branch_root) {
            // We add the removed nodes children to the list that we will remove next
            let mut removeable: Vec<K> = removed.children.clone();
            // We push the node into the list of nodes we will return
            ret.push(removed);
            // As long as there are possible nodes in this branch we repeatedly
            // remove a node, if it succeeds we push its children to
            // the list of removable nodes, then append the node to the return list.
            while !removeable.is_empty() {
                let mut remove_next = Vec::new();
                for key in &removeable {
                    if let Some(mut removed_last) = self.nodes_by_key.remove(key) {
                        remove_next.append(&mut removed_last.children);
                        ret.push(removed_last);
                    }
                }
                removeable = remove_next;
            }
        }
        ret
    }
pub fn delete_children ( & mut self , branch_root : & K ) -> Vec < ReorgNode < K , M > > { let mut ret : Vec < ReorgNode < K , M > > = Vec :: new ( ) ; // First we try to remove the designated node from the system if let Some ( removed ) = self . nodes_by_key . remove ( branch_root ) { // We add the removed nodes children to the list that we will remove next let mut removeable : Vec < K > = removed . children . clone ( ) ; // We push the node into the list of nodes we will return ret . push ( removed ) ; // As long as there are possible nodes in this branch we repeatedly // remove a node, if it succeeds we push its children to // the list of removable nodes, then append the node to the return list. while ! removeable . is_empty ( ) { let mut remove_next = Vec :: new ( ) ; for key in & removeable { if let Some ( mut removed_last ) = self . nodes_by_key . remove ( key ) { remove_next . append ( & mut removed_last . children ) ; ret . push ( removed_last ) ; } } removeable = remove_next ; } } ret }
This function is part of the garbage collection.
This function is part of the garbage collection .
&mut self
branch_root
&K
&mut self
branch_root
&K