pub fn remove_node(&mut self, ap: AccessPath) -> Option<TrieNode<T>> {
        let mut node = self.0.get_mut(ap.root())?;

        // If no offset, we want to remove the root node
        if ap.offsets().is_empty() {
            if node.children.is_empty() {
                return self.0.remove(ap.root());
            } else {
                node.data = None;
            }
        // Otherwise, find the offset in the trie
        } else {
            let offsets_count = ap.offsets().len();
            for offset in &ap.offsets()[0..offsets_count - 1] {
                node = node.get_offset_mut(offset)?;
            }
            let last_offset = &ap.offsets()[offsets_count - 1];
            let to_remove = node.get_offset_mut(last_offset)?;

            if to_remove.children.is_empty() {
                return node.remove_offset(last_offset);
            } else {
                to_remove.data = None;
            }
        }
        None
    }
/// Removes node located at the given access path
/// Returns the node if it has been fully removed from the trie (i.e. it did not have any children)
Removes node located at the given access path
Returns the node if it has been fully removed from the trie
Removes node located at the given access path Returns the node if it has been fully removed from the trie
pub fn remove_node(&mut self, ap: AccessPath) -> Option<TrieNode<T>> {
        let mut node = self.0.get_mut(ap.root())?;
        // If no offset, we want to remove the root node
        if ap.offsets().is_empty() {
            if node.children.is_empty() {
                return self.0.remove(ap.root());
            } else {
                node.data = None;
            }
        // Otherwise, find the offset in the trie
        } else {
            let offsets_count = ap.offsets().len();
            for offset in &ap.offsets()[0..offsets_count - 1] {
                node = node.get_offset_mut(offset)?;
            }
            let last_offset = &ap.offsets()[offsets_count - 1];
            let to_remove = node.get_offset_mut(last_offset)?;
            if to_remove.children.is_empty() {
                return node.remove_offset(last_offset);
            } else {
                to_remove.data = None;
            }
        }
        None
    }
pub fn remove_node ( & mut self , ap : AccessPath ) -> Option < TrieNode < T > > { let mut node = self . 0 . get_mut ( ap . root ( ) ) ? ; // If no offset, we want to remove the root node if ap . offsets ( ) . is_empty ( ) { if node . children . is_empty ( ) { return self . 0 . remove ( ap . root ( ) ) ; } else { node . data = None ; } // Otherwise, find the offset in the trie } else { let offsets_count = ap . offsets ( ) . len ( ) ; for offset in & ap . offsets ( ) [ 0 .. offsets_count - 1 ] { node = node . get_offset_mut ( offset ) ? ; } let last_offset = & ap . offsets ( ) [ offsets_count - 1 ] ; let to_remove = node . get_offset_mut ( last_offset ) ? ; if to_remove . children . is_empty ( ) { return node . remove_offset ( last_offset ) ; } else { to_remove . data = None ; } } None }
Removes node located at the given access path
Returns the node if it has been fully removed from the trie (i.e.
Removes node located at the given access path Returns the node if it has been fully removed from the trie ( i . e .
&mut self
ap
AccessPath