pub struct Environment<Name: Eq + Hash, T> { /* private fields */ }
Expand description
A scoped set of bindings between names and values.
Implementations§
Source§impl<Name: Eq + Hash, T> Environment<Name, T>
impl<Name: Eq + Hash, T> Environment<Name, T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new context with a base scope that further scopes can be pushed and popped on top of.
Sourcepub fn pop(&mut self) -> bool
pub fn pop(&mut self) -> bool
Removes all bindings in the most recent scope, returning true
unless
there are no scopes beside the base scope.
Sourcepub fn bind(&mut self, name: Name, value: T) -> Option<T>
pub fn bind(&mut self, name: Name, value: T) -> Option<T>
Binds name
to value
in the top scope, returning
Some(previous_value)
if previous_value
had previously been bound to
name
, or None
.
Sourcepub fn bind_base(&mut self, name: Name, value: T) -> Option<T>
pub fn bind_base(&mut self, name: Name, value: T) -> Option<T>
Binds name
to value
in the base scope.
@see Environment::bind
Trait Implementations§
Auto Trait Implementations§
impl<Name, T> Freeze for Environment<Name, T>
impl<Name, T> RefUnwindSafe for Environment<Name, T>where
Name: RefUnwindSafe,
T: RefUnwindSafe,
impl<Name, T> Send for Environment<Name, T>
impl<Name, T> Sync for Environment<Name, T>
impl<Name, T> Unpin for Environment<Name, T>
impl<Name, T> UnwindSafe for Environment<Name, T>where
Name: UnwindSafe,
T: UnwindSafe,
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