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)
| 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 })) |