[−][src]Struct hamst::HamtMut
Mutable HAMT data structure
This is created after a thaw of an immutable HAMT, and right after the creation, all the node are still shared with the immutable HAMT.
Once modification happens, then each nodes from root to leaf will be modified and kept in an efficient mutable format until freezing.
Implementations
impl<H: Hasher + Default, K: Clone + Eq + Hash, V: Clone> HamtMut<K, V, H>
[src]
impl<H, K, V> HamtMut<K, V, H>
[src]
pub fn freeze(self) -> Hamt<K, V, H>
[src]
Freeze the mutable HAMT back into an immutable HAMT
This recursively freeze all the mutable nodes
impl<H: Hasher + Default, K: Clone + Eq + Hash, V: Clone> HamtMut<K, V, H>
[src]
pub fn insert(&mut self, k: K, v: V) -> Result<(), InsertError>
[src]
Insert a new key into the HAMT
If the key already exists, then an InsertError is returned.
To simulaneously manipulate a key, either to insert or update, use 'insert_or_update'
impl<H: Hasher + Default, K: Eq + Hash + Clone, V: PartialEq + Clone> HamtMut<K, V, H>
[src]
pub fn remove_match(&mut self, k: &K, v: &V) -> Result<(), RemoveError>
[src]
Remove a key from the HAMT, if it also matching the value V
If the key doesn't exist, then RemoveError::KeyNotFound will be returned and otherwise if the key exists but the value doesn't match, RemoveError::ValueNotMatching will be returned.
impl<H: Hasher + Default, K: Clone + Eq + Hash, V: Clone> HamtMut<K, V, H>
[src]
pub fn remove(&mut self, k: &K) -> Result<(), RemoveError>
[src]
Remove a key from the HAMT
If the key doesn't exist, then RemoveError::KeyNotFound will be returned
impl<H: Hasher + Default, K: Eq + Hash + Clone, V: Clone> HamtMut<K, V, H>
[src]
pub fn replace(&mut self, k: &K, v: V) -> Result<V, ReplaceError>
[src]
Replace the element at the key by the v and return the new tree and the old value.
pub fn replace_with<F>(&mut self, k: &K, f: F) -> Result<(), ReplaceError> where
F: FnOnce(&V) -> V,
[src]
F: FnOnce(&V) -> V,
Replace the element at the key by the v and return the new tree and the old value.
impl<H: Hasher + Default, K: Eq + Hash + Clone, V: Clone> HamtMut<K, V, H>
[src]
pub fn update<F, U>(&mut self, k: &K, f: F) -> Result<(), UpdateError<U>> where
F: FnOnce(&V) -> Result<Option<V>, U>,
[src]
F: FnOnce(&V) -> Result<Option<V>, U>,
Update the element at the key K.
If the closure F in parameter returns None, then the key is deleted.
If the key is not present then UpdateError::KeyNotFound is returned
pub fn insert_or_update<F, E>(&mut self, k: K, v: V, f: F) -> Result<(), E> where
F: FnOnce(&V) -> Result<Option<V>, E>,
V: Clone,
[src]
F: FnOnce(&V) -> Result<Option<V>, E>,
V: Clone,
Update or insert the element at the key K
If the element is not present, then V is added, otherwise the closure F is apply to the found element. If the closure returns None, then the key is deleted
pub fn insert_or_update_simple<F>(&mut self, k: K, v: V, f: F) where
F: for<'a> FnOnce(&'a V) -> Option<V>,
V: Clone,
[src]
F: for<'a> FnOnce(&'a V) -> Option<V>,
V: Clone,
Update or insert the element at the key K
If the element is not present, then V is added, otherwise the closure F is apply to the found element. If the closure returns None, then the key is deleted.
This is similar to 'insert_or_update' except the closure shouldn't be failing
Trait Implementations
impl<H, K, V> Clone for HamtMut<K, V, H>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, H, K, V> From<&'a Hamt<K, V, H>> for HamtMut<K, V, H>
[src]
impl<H: Default + Hasher, K: Eq + Hash + Clone, V: Clone> FromIterator<(K, V)> for HamtMut<K, V, H>
[src]
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
[src]
Auto Trait Implementations
impl<K, V, H> RefUnwindSafe for HamtMut<K, V, H> where
H: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
H: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V, H> Send for HamtMut<K, V, H> where
H: Send,
K: Send + Sync,
V: Send + Sync,
H: Send,
K: Send + Sync,
V: Send + Sync,
impl<K, V, H> Sync for HamtMut<K, V, H> where
H: Sync,
K: Send + Sync,
V: Send + Sync,
H: Sync,
K: Send + Sync,
V: Send + Sync,
impl<K, V, H> Unpin for HamtMut<K, V, H> where
H: Unpin,
H: Unpin,
impl<K, V, H> UnwindSafe for HamtMut<K, V, H> where
H: UnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
H: UnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,