pub struct VmMap { /* private fields */ }Expand description
Runtime map storage for VM values.
Keys and values may be any runtime Value. Key equality is hybrid:
scalars, strings, and bytes compare by value, while arrays and maps compare by
heap-object identity. Float keys use canonicalized IEEE bits: 0.0 /
-0.0 are treated as the same key, while NaN keys only compare equal
when their bit patterns match. Duplicate inserts overwrite the prior value
for the same key.
Heap-backed keys remain stable after insertion. Values are reference-counted and container writes detach before mutation, so later writes through an alias create a new heap object instead of mutating a key already stored in the map.
Implementations§
Source§impl VmMap
impl VmMap
pub fn new() -> Self
pub fn from_entries(entries: Vec<(Value, Value)>) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> VmMapIter<'_> ⓘ
pub fn get(&self, key: &Value) -> Option<&Value>
pub fn insert(&mut self, key: Value, value: Value) -> Option<Value>
pub fn remove(&mut self, key: &Value) -> Option<Value>
Trait Implementations§
impl Eq for VmMap
Source§impl IntoIterator for VmMap
impl IntoIterator for VmMap
Source§impl<'a> IntoIterator for &'a VmMap
impl<'a> IntoIterator for &'a VmMap
Auto Trait Implementations§
impl Freeze for VmMap
impl RefUnwindSafe for VmMap
impl Send for VmMap
impl Sync for VmMap
impl Unpin for VmMap
impl UnsafeUnpin for VmMap
impl UnwindSafe for VmMap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.