pub struct Frame<'scope> { /* private fields */ }
Expand description
Represents a stack frame
Methods from Deref<Target = Environment>§
pub fn builtins(&self) -> &HashMap<Sym, Option<ConValue>>
pub fn add_builtin(&mut self, builtin: &'static Builtin) -> &mut Self
pub fn add_builtins(&mut self, builtins: &'static [Builtin])
pub fn push_frame( &mut self, name: &'static str, frame: HashMap<Sym, Option<ConValue>>, )
pub fn pop_frame( &mut self, ) -> Option<(HashMap<Sym, Option<ConValue>>, &'static str)>
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§
Auto Trait Implementations§
impl<'scope> Freeze for Frame<'scope>
impl<'scope> !RefUnwindSafe for Frame<'scope>
impl<'scope> !Send for Frame<'scope>
impl<'scope> !Sync for Frame<'scope>
impl<'scope> Unpin for Frame<'scope>
impl<'scope> !UnwindSafe for Frame<'scope>
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