Skip to main content

Locals

Type Alias Locals 

Source
pub type Locals = Mutex<HashMap<Arc<str>, Value>>;
Expand description

Type alias for the bindings table. Wrapped in Mutex so concurrent host evaluators sharing a Scope across threads stay safe; the inner HashMap starts empty (zero-capacity, no heap allocation) and only grows when something actually writes a binding.

Keys are stored as Arc<str> so that the comprehension / closure hot loops can rebind the same identifier on every iteration via an Arc::clone (refcount bump, no heap touch) instead of a full String::clone (malloc + memcpy). HashMap lookup still accepts &str queries through the standard Borrow<str> impl on Arc<str>, so read sites are unchanged.

Aliased Typeยง

pub struct Locals { /* private fields */ }