Skip to main content

DictMap

Type Alias DictMap 

Source
pub type DictMap = OrdMap<String, VmValue>;
Expand description

Backing store for VmValue::Dict: a persistent, ordered, structurally shared map.

Replacing the former BTreeMap with imbl::OrdMap turns the copy-on-write Arc::make_mut clone — performed on every dict mutation whenever the value is aliased (on the stack, in another local, captured by a closure) — from an O(n) deep copy of every key and entry into an O(log n) path copy. Ordering and the read API (get / iter / keys / values / contains_key / range / len) match BTreeMap, so dict reads are unchanged. The Arc wrapper is retained so reference identity (Arc::ptr_eq) — used by the === operator and value_identity_key — keeps its current semantics.

Aliased Type§

pub struct DictMap { /* private fields */ }

Trait Implementations§

Source§

impl DictRetain for DictMap

Source§

fn retain(&mut self, keep: impl FnMut(&String, &mut VmValue) -> bool)