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

Method new_branch

src/node.rs:118–122  ·  view source on GitHub ↗

Creates a new branch [Node] from a [Nibbles] prefix. # Panics This function will panic if the provided prefix is greater than 64 nibbles long.

(prefix: &RawPath)

Source from the content-addressed store, hash-verified

116 ///
117 /// This function will panic if the provided prefix is greater than 64 nibbles long.
118 pub fn new_branch(prefix: &RawPath) -> Result<Self, NodeError> {
119 let prefix = prefix.try_into().map_err(|_| NodeError::MaxPrefixLengthExceeded)?;
120
121 Ok(Self::new(prefix, NodeKind::Branch { children: [const { None }; 16] }))
122 }
123
124 fn new(prefix: Nibbles, kind: NodeKind) -> Self {
125 Self(Box::new(NodeInner { prefix, kind }))

Callers

nothing calls this directly

Calls 1

try_intoMethod · 0.80

Tested by

no test coverage detected