pub struct ChampMap<K, V> { /* private fields */ }Expand description
Persistent hash map based on a CHAMP trie, single-threaded.
Same set of key-value pairs always produces the same trie structure
(canonical form), enabling O(1) structural equality via adhash.
Implementations§
Source§impl<K, V> ChampMap<K, V>
impl<K, V> ChampMap<K, V>
Sourcepub const fn adhash(&self) -> u64
pub const fn adhash(&self) -> u64
Returns the current AdHash value.
Two maps with the same AdHash and the same length contain the same
entries with overwhelming probability (2⁻⁶⁴ collision chance).
Sourcepub fn checkpoint(&self) -> ChampCheckpoint<K, V>
pub fn checkpoint(&self) -> ChampCheckpoint<K, V>
Saves the current map state for later rollback.
Sourcepub fn arena_len(&self) -> (usize, usize, usize)
pub fn arena_len(&self) -> (usize, usize, usize)
Returns the total number of allocated items in each arena:
(nodes, entries, children).
Includes dead COW copies — reflects true memory footprint.
Sourcepub fn rollback(&mut self, cp: ChampCheckpoint<K, V>)
pub fn rollback(&mut self, cp: ChampCheckpoint<K, V>)
Restores the map to a previously saved checkpoint.
All changes made after the checkpoint are discarded.
Source§impl<K: Hash + Eq + Clone, V: Hash + Clone> ChampMap<K, V>
impl<K: Hash + Eq + Clone, V: Hash + Clone> ChampMap<K, V>
Trait Implementations§
Source§impl<K: Hash + Eq + Clone, V: Hash + Clone> Extend<(K, V)> for ChampMap<K, V>
impl<K: Hash + Eq + Clone, V: Hash + Clone> Extend<(K, V)> for ChampMap<K, V>
Source§fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a, K, V> IntoIterator for &'a ChampMap<K, V>
impl<'a, K, V> IntoIterator for &'a ChampMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for ChampMap<K, V>
impl<K, V> RefUnwindSafe for ChampMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for ChampMap<K, V>
impl<K, V> Sync for ChampMap<K, V>
impl<K, V> Unpin for ChampMap<K, V>
impl<K, V> UnsafeUnpin for ChampMap<K, V>
impl<K, V> UnwindSafe for ChampMap<K, V>where
K: UnwindSafe,
V: UnwindSafe,
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