pub trait MapLike: Sized {
// Required methods
fn new() -> Self;
fn get(&self, key: &u64) -> Option<&(NanValue, NanValue)>;
fn insert(&self, key: u64, value: (NanValue, NanValue)) -> Self;
fn rewrite_values_mut(&mut self, f: impl FnMut(&mut (NanValue, NanValue)));
fn len(&self) -> usize;
fn iter(&self) -> impl Iterator<Item = (&u64, &(NanValue, NanValue))>;
fn values(&self) -> impl Iterator<Item = &(NanValue, NanValue)>;
// Provided methods
fn insert_owned(self, key: u64, value: (NanValue, NanValue)) -> Self { ... }
fn is_empty(&self) -> bool { ... }
}Expand description
Trait abstracting the persistent-map operations needed by the arena.
Implementors provide a hash-keyed map from u64 to (NanValue, NanValue).
Required Methods§
fn new() -> Self
fn get(&self, key: &u64) -> Option<&(NanValue, NanValue)>
fn insert(&self, key: u64, value: (NanValue, NanValue)) -> Self
Sourcefn rewrite_values_mut(&mut self, f: impl FnMut(&mut (NanValue, NanValue)))
fn rewrite_values_mut(&mut self, f: impl FnMut(&mut (NanValue, NanValue)))
Rewrite NanValue pairs in place — avoids rebuilding the hash table. Uses copy-on-write: O(1) when sole owner, O(n) clone when shared.
fn len(&self) -> usize
fn iter(&self) -> impl Iterator<Item = (&u64, &(NanValue, NanValue))>
fn values(&self) -> impl Iterator<Item = &(NanValue, NanValue)>
Provided Methods§
Sourcefn insert_owned(self, key: u64, value: (NanValue, NanValue)) -> Self
fn insert_owned(self, key: u64, value: (NanValue, NanValue)) -> Self
Insert with owned self — avoids clone when sole owner.
fn is_empty(&self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl MapLike for AverMap<u64, (NanValue, NanValue)>
Available on crate feature runtime only.
impl MapLike for AverMap<u64, (NanValue, NanValue)>
Available on crate feature
runtime only.