Struct cl_interpret::env::Environment
source · pub struct Environment { /* private fields */ }
Expand description
Implements a nested lexical scope
Implementations§
source§impl Environment
impl Environment
pub fn new() -> Self
sourcepub fn no_builtins(name: &'static str) -> Self
pub fn no_builtins(name: &'static str) -> Self
Creates an Environment with no builtins
pub fn eval(&mut self, node: &impl Interpret) -> IResult<ConValue>
sourcepub fn call(&mut self, name: Sym, args: &[ConValue]) -> IResult<ConValue>
pub fn call(&mut self, name: Sym, args: &[ConValue]) -> IResult<ConValue>
Calls a function inside the interpreter’s scope, and returns the result
sourcepub fn frame(&mut self, name: &'static str) -> Frame<'_>
pub fn frame(&mut self, name: &'static str) -> Frame<'_>
Enters a nested scope, returning a Frame
stack-guard.
Frame
implements Deref/DerefMut for Environment
.
sourcepub fn get_mut(&mut self, id: Sym) -> IResult<&mut Option<ConValue>>
pub fn get_mut(&mut self, id: Sym) -> IResult<&mut Option<ConValue>>
Resolves a variable mutably.
Returns a mutable reference to the variable’s record, if it exists.
sourcepub fn get(&self, id: Sym) -> IResult<ConValue>
pub fn get(&self, id: Sym) -> IResult<ConValue>
Resolves a variable immutably.
Returns a reference to the variable’s contents, if it is defined and initialized.
Trait Implementations§
source§impl Clone for Environment
impl Clone for Environment
source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Environment
impl Debug for Environment
source§impl Default for Environment
impl Default for Environment
Auto Trait Implementations§
impl Freeze for Environment
impl !RefUnwindSafe for Environment
impl !Send for Environment
impl !Sync for Environment
impl Unpin for Environment
impl !UnwindSafe for Environment
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