[−][src]Struct hamst::Hamt
HAMT with shareable nodes
The structure is immutable from root to leaves, where each node of this structure is also independently shareable, including on different thread.
Implementations
impl<H: Hasher + Default, K: PartialEq + Eq + Hash, V> Hamt<K, V, H>
[src]
pub fn new() -> Self
[src]
Create a new empty HAMT
pub fn is_empty(&self) -> bool
[src]
Check if the HAMT is empty
pub fn size(&self) -> usize
[src]
Return the number of elements in this HAMT
pub fn thaw(&self) -> HamtMut<K, V, H>
[src]
Thaw this HAMT into a HAMT that can be mutated
pub fn mutate_freeze<E, F>(&self, f: F) -> Result<Self, E> where
F: FnOnce(&mut HamtMut<K, V, H>) -> Result<(), E>,
[src]
F: FnOnce(&mut HamtMut<K, V, H>) -> Result<(), E>,
Temporary create a mutable HAMT from an immutable one, and apply the callback f to the mutable reference, then thaw into the resulting HAMT
let empty : Hamt<u32, u32, DefaultHasher> = Hamt::new(); let result = reference.freeze(|x| { x.insert(10, 20)?; x.insert(20, 30) }).expect("it works");
pub fn mutate_freeze_ret<E, F, R>(&self, f: F) -> Result<(Self, R), E> where
F: FnOnce(&mut HamtMut<K, V, H>) -> Result<R, E>,
[src]
F: FnOnce(&mut HamtMut<K, V, H>) -> Result<R, E>,
Similar to 'mutate_freeze' and also returns the result of f too
impl<H: Hasher + Default, K: Hash + Eq, V> Hamt<K, V, H>
[src]
pub fn lookup(&self, k: &K) -> Option<&V>
[src]
Try to get the element related to key K
pub fn contains_key(&self, k: &K) -> bool
[src]
Check if the key is contained into the HAMT
pub fn iter(&self) -> HamtIter<'_, K, V>ⓘ
[src]
Create a new iterator for this HAMT
Trait Implementations
impl<H, K, V> Clone for Hamt<K, V, H>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<H: Hasher + Default, K: Eq + Hash, V> Default for Hamt<K, V, H>
[src]
impl<H: Default + Hasher, K: Eq + Hash, V: Eq> Eq for Hamt<K, V, H>
[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 Hamt<K, V, H>
[src]
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
[src]
impl<H: Default + Hasher, K: Eq + Hash, V: PartialEq> PartialEq<Hamt<K, V, H>> for Hamt<K, V, H>
[src]
Auto Trait Implementations
impl<K, V, H> RefUnwindSafe for Hamt<K, V, H> where
H: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
H: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V, H> Send for Hamt<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 Hamt<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 Hamt<K, V, H> where
H: Unpin,
H: Unpin,
impl<K, V, H> UnwindSafe for Hamt<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>,