pub struct LocalEnv<'a, V> { /* private fields */ }Expand description
A layered lexical environment for HIR locals.
Each binder (for-comp, scan, unfold, match arm) layers a child frame
holding its few bindings over the enclosing environment instead of cloning
the full local map; lookup walks the parent chain. LocalIds are unique
within one lowered body, so frames never shadow one another — the chain is
purely an ownership layering, and nested binders cost O(own bindings)
instead of O(visible locals).
Implementations§
Source§impl<'a, V> LocalEnv<'a, V>
impl<'a, V> LocalEnv<'a, V>
Sourcepub const fn from_bindings(bindings: Vec<(LocalId, V)>) -> Self
pub const fn from_bindings(bindings: Vec<(LocalId, V)>) -> Self
Create a root environment holding the given bindings.
Sourcepub const fn child<'b>(&'b self, bindings: Vec<(LocalId, V)>) -> LocalEnv<'b, V>where
'a: 'b,
pub const fn child<'b>(&'b self, bindings: Vec<(LocalId, V)>) -> LocalEnv<'b, V>where
'a: 'b,
Layer a child frame holding bindings over this environment.
Trait Implementations§
Auto Trait Implementations§
impl<'a, V> Freeze for LocalEnv<'a, V>
impl<'a, V> RefUnwindSafe for LocalEnv<'a, V>where
V: RefUnwindSafe,
impl<'a, V> Send for LocalEnv<'a, V>
impl<'a, V> Sync for LocalEnv<'a, V>where
V: Sync,
impl<'a, V> Unpin for LocalEnv<'a, V>where
V: Unpin,
impl<'a, V> UnsafeUnpin for LocalEnv<'a, V>
impl<'a, V> UnwindSafe for LocalEnv<'a, V>where
V: UnwindSafe + RefUnwindSafe,
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