pub struct Frame<'scope> {
scope: &'scope mut Environment,
}Expand description
Represents a stack frame
Fields§
§scope: &'scope mut EnvironmentImplementations§
Source§impl<'scope> Frame<'scope>
impl<'scope> Frame<'scope>
fn new( scope: &'scope mut Environment, name: &'static str, span: Option<Span>, ) -> Self
pub fn pop_values(self) -> Option<StackFrame>
pub fn into_binds(self) -> Option<StackBinds>
Methods from Deref<Target = Environment>§
Sourcepub fn eval(&mut self, node: &impl Interpret) -> IResult<ConValue>
pub fn eval(&mut self, node: &impl Interpret) -> IResult<ConValue>
Reflexively evaluates a node
Sourcepub fn call(&mut self, name: Symbol, args: &[ConValue]) -> IResult<ConValue>
pub fn call(&mut self, name: Symbol, args: &[ConValue]) -> IResult<ConValue>
Calls a function inside the Environment’s scope, and returns the result
Sourcepub fn bind(&mut self, name: impl Into<Symbol>, value: impl Into<ConValue>)
pub fn bind(&mut self, name: impl Into<Symbol>, value: impl Into<ConValue>)
Binds a value to the given name in the current scope.
pub fn bind_raw(&mut self, name: Symbol, id: usize) -> Option<()>
pub fn backtrace(&self) -> Backtrace<'_>
Sourcepub fn add_builtins(&mut self, builtins: &'static [Builtin]) -> &mut Self
pub fn add_builtins(&mut self, builtins: &'static [Builtin]) -> &mut Self
pub fn push_frame(&mut self, name: &'static str, frame: StackFrame)
pub fn pop_frame(&mut self) -> Option<(StackFrame, &'static str)>
Sourcepub fn frame(&mut self, name: &'static str, span: Option<Span>) -> Frame<'_>
pub fn frame(&mut self, name: &'static str, span: Option<Span>) -> Frame<'_>
Enters a nested scope, returning a Frame stack-guard.
Frame implements Deref/DerefMut for Environment.
Sourcepub fn with_frame<'e>(
&'e mut self,
name: &'static str,
frame: StackFrame,
) -> Frame<'e>
pub fn with_frame<'e>( &'e mut self, name: &'static str, frame: StackFrame, ) -> Frame<'e>
Enters a nested scope, assigning the contents of frame,
and returning a Frame stack-guard.
Frame implements Deref/DerefMut for Environment.
Sourcepub fn get_mut(&mut self, name: Symbol) -> IResult<&mut ConValue>
pub fn get_mut(&mut self, name: Symbol) -> IResult<&mut ConValue>
Resolves a variable mutably.
Returns a mutable reference to the variable’s record, if it exists.
Sourcepub fn get(&self, name: Symbol) -> IResult<ConValue>
pub fn get(&self, name: Symbol) -> IResult<ConValue>
Resolves a variable immutably.
Returns a reference to the variable’s contents, if it is defined and initialized.
Sourcepub fn id_of(&self, name: Symbol) -> IResult<usize>
pub fn id_of(&self, name: Symbol) -> IResult<usize>
Resolves the index associated with a Symbol
pub fn get_id(&self, id: usize) -> Option<&ConValue>
pub fn get_id_mut(&mut self, id: usize) -> Option<&mut ConValue>
pub fn get_slice(&self, start: usize, len: usize) -> Option<&[ConValue]>
pub fn get_slice_mut( &mut self, start: usize, len: usize, ) -> Option<&mut [ConValue]>
pub fn def_type(&mut self, name: Symbol, model: Model) -> Type
pub fn get_type(&self, name: Symbol) -> Option<Type>
Sourcepub fn stack_alloc(&mut self, value: ConValue) -> IResult<usize>
pub fn stack_alloc(&mut self, value: ConValue) -> IResult<usize>
Allocates a local variable
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