pub struct Ctx {
pub values: Vec<N>,
pub idents: Vec<String>,
pub code: Vec<char>,
pub deep: usize,
}
Expand description
Interpreter context, holds all state during execution.
Fields§
§values: Vec<N>
§idents: Vec<String>
§code: Vec<char>
§deep: usize
Implementations§
Source§impl Ctx
impl Ctx
pub fn new() -> Ctx
pub fn drain(&mut self, from: usize)
pub fn set_val(&mut self, name: &str, n: N)
pub fn set_val_absolute(&mut self, i: usize, name: &str, n: N)
Sourcepub fn find_var(&mut self, name: &str) -> Option<(usize, &mut N)>
pub fn find_var(&mut self, name: &str) -> Option<(usize, &mut N)>
Find a variable declared in the scope, or any parent scope
returns the path and the variable value
pub fn insert_code(&mut self, code: &str)
pub fn parse_next_expr(&mut self) -> Result<N, &'static str>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ctx
impl !RefUnwindSafe for Ctx
impl !Send for Ctx
impl !Sync for Ctx
impl Unpin for Ctx
impl !UnwindSafe for Ctx
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