Function blart::insert_unchecked
source · pub unsafe fn insert_unchecked<K, V>(
root: OpaqueNodePtr<K, V>,
key: K,
value: V
) -> Result<InsertResult<K, V>, InsertPrefixError>where
K: AsBytes,
Expand description
Insert the given key-value pair into the tree.
Returns either a pointer to the new tree root or an error.
If the given key already exists in the tree, the old key and value will be replaced and be returned.
Errors
- Returns a
InsertPrefixError<K>
if the given key is a prefix of another key that exists in the trie. Or if the given key is prefixed by an existing key in the trie.
Safety
- The
root
OpaqueNodePtr
must be a unique pointer to the underlying tree - This function cannot be called concurrently to any reads or writes of the
root
node or any child node ofroot
. This function will arbitrarily read or write to any child in the given tree.