pub struct MapTree<Key: Hash + Eq + Clone, T: Clone> { /* private fields */ }Expand description
A persistent, indexable, hierarchical data structure that maintains a key-node mapping
See the module docs for more information
Implementations§
Source§impl<Key: Hash + Eq + Clone, T: Clone> MapTree<Key, T>
impl<Key: Hash + Eq + Clone, T: Clone> MapTree<Key, T>
Sourcepub fn new_with_root(key: Key, value: T) -> Self
pub fn new_with_root(key: Key, value: T) -> Self
Create a new Tree with the specified root node key and value
Sourcepub fn insert(
&mut self,
key: Key,
value: T,
location: Location<Key>,
) -> Result<(), InsertError<Key>>
pub fn insert( &mut self, key: Key, value: T, location: Location<Key>, ) -> Result<(), InsertError<Key>>
Insert a new node at the specified location
Error if the location is invalid:
- The root node cannot have siblings
- The location must reference only existing nodes
Also, errors if the specified key is already present in the MapTree.
Sourcepub fn root(&self) -> NodeRef<'_, Key, T>
pub fn root(&self) -> NodeRef<'_, Key, T>
Get a reference to the root node
The tree will always have a root node
Sourcepub fn root_mut(&mut self) -> NodeMut<'_, Key, T>
pub fn root_mut(&mut self) -> NodeMut<'_, Key, T>
Get a mutable reference to the root node
The tree will always have a root node
Trait Implementations§
impl<Key: Hash + Eq + Clone, T: Clone> StructuralPartialEq for MapTree<Key, T>
Auto Trait Implementations§
impl<Key, T> Freeze for MapTree<Key, T>
impl<Key, T> RefUnwindSafe for MapTree<Key, T>where
T: RefUnwindSafe,
Key: RefUnwindSafe,
impl<Key, T> Send for MapTree<Key, T>
impl<Key, T> Sync for MapTree<Key, T>
impl<Key, T> Unpin for MapTree<Key, T>
impl<Key, T> UnwindSafe for MapTree<Key, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more