MCPcopy Create free account
hub / github.com/base/triedb / remove_child

Method remove_child

src/node.rs:239–251  ·  view source on GitHub ↗

Removes the child of the [Node] at the given index. # Panics This function will panic if the [Node] type does not support children.

(&mut self, index: u8)

Source from the content-addressed store, hash-verified

237 ///
238 /// This function will panic if the [Node] type does not support children.
239 pub fn remove_child(&mut self, index: u8) -> Result<(), NodeError> {
240 match self.0.kind {
241 NodeKind::AccountLeaf { ref mut storage_root, .. } => {
242 *storage_root = None;
243 Ok(())
244 }
245 NodeKind::Branch { ref mut children } => {
246 children[index as usize] = None;
247 Ok(())
248 }
249 _ => Err(NodeError::ChildrenUnsupported),
250 }
251 }
252
253 /// Returns the value of the [Node].
254 ///

Callers 1

update_node_childMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected