Skip to main content

MapLike

Trait MapLike 

Source
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 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§

Source

fn new() -> Self

Source

fn get(&self, key: &u64) -> Option<&(NanValue, NanValue)>

Source

fn insert(&self, key: u64, value: (NanValue, NanValue)) -> Self

Source

fn len(&self) -> usize

Source

fn iter(&self) -> impl Iterator<Item = (&u64, &(NanValue, NanValue))>

Source

fn values(&self) -> impl Iterator<Item = &(NanValue, NanValue)>

Provided Methods§

Source

fn insert_owned(self, key: u64, value: (NanValue, NanValue)) -> Self

Insert with owned self — avoids clone when sole owner.

Source

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.

Implementors§

Source§

impl MapLike for PersistentMap

Available on non-crate feature runtime only.