pub struct Evaluator { /* private fields */ }Expand description
Evaluator for Aether programs
Implementations§
Source§impl Evaluator
impl Evaluator
Sourcepub fn set_limits(&mut self, limits: ExecutionLimits)
pub fn set_limits(&mut self, limits: ExecutionLimits)
Set execution limits (public API)
Sourcepub fn limits(&self) -> &ExecutionLimits
pub fn limits(&self) -> &ExecutionLimits
Get execution limits (public API)
Sourcepub fn with_permissions(permissions: IOPermissions) -> Self
pub fn with_permissions(permissions: IOPermissions) -> Self
Create a new evaluator with custom IO permissions
Sourcepub fn with_env(env: Rc<RefCell<Environment>>) -> Self
pub fn with_env(env: Rc<RefCell<Environment>>) -> Self
Create evaluator with custom environment
Sourcepub fn clear_call_stack(&mut self)
pub fn clear_call_stack(&mut self)
Clear the call stack (used by top-level entry points like Aether::eval).
Sourcepub fn set_module_resolver(&mut self, resolver: Box<dyn ModuleResolver>)
pub fn set_module_resolver(&mut self, resolver: Box<dyn ModuleResolver>)
Configure the module resolver used for Import/Export.
Sourcepub fn push_import_base(&mut self, module_id: String, base_dir: Option<PathBuf>)
pub fn push_import_base(&mut self, module_id: String, base_dir: Option<PathBuf>)
Push a base directory context for resolving relative imports.
This is typically used by CLI eval_file() wrappers.
Sourcepub fn pop_import_base(&mut self)
pub fn pop_import_base(&mut self)
Pop the most recent base directory context.
Sourcepub fn trace_push(&mut self, msg: String)
pub fn trace_push(&mut self, msg: String)
Append a trace entry (host-readable; no IO side effects).
Sourcepub fn take_trace(&mut self) -> Vec<String>
pub fn take_trace(&mut self) -> Vec<String>
Drain the trace buffer.
Sourcepub fn trace_records(&self) -> Vec<TraceEntry>
pub fn trace_records(&self) -> Vec<TraceEntry>
Get all structured trace entries
Sourcepub fn trace_by_level(&self, level: TraceLevel) -> Vec<TraceEntry>
pub fn trace_by_level(&self, level: TraceLevel) -> Vec<TraceEntry>
Filter trace entries by level
Sourcepub fn trace_by_category(&self, category: &str) -> Vec<TraceEntry>
pub fn trace_by_category(&self, category: &str) -> Vec<TraceEntry>
Filter trace entries by category
Sourcepub fn trace_by_label(&self, label: &str) -> Vec<TraceEntry>
pub fn trace_by_label(&self, label: &str) -> Vec<TraceEntry>
Filter trace entries by label
Sourcepub fn trace_since(&self, since: Instant) -> Vec<TraceEntry>
pub fn trace_since(&self, since: Instant) -> Vec<TraceEntry>
Filter trace entries by time range (since)
Sourcepub fn trace_filter(&self, filter: &TraceFilter) -> Vec<TraceEntry>
pub fn trace_filter(&self, filter: &TraceFilter) -> Vec<TraceEntry>
Apply complex filter to trace entries
Sourcepub fn trace_stats(&self) -> TraceStats
pub fn trace_stats(&self) -> TraceStats
Get trace statistics
Sourcepub fn clear_trace(&mut self)
pub fn clear_trace(&mut self)
Clear the trace buffer.
Sourcepub fn reset_env(&mut self)
pub fn reset_env(&mut self)
Reset the environment (clear all variables and re-register built-ins)
This is useful for engine pooling and global singleton patterns where you want to reuse an engine instance but ensure isolation.
Sourcepub fn set_global(&mut self, name: impl Into<String>, value: Value)
pub fn set_global(&mut self, name: impl Into<String>, value: Value)
Set a global variable from the host (without requiring eval).
Sourcepub fn enter_child_scope(&mut self) -> Rc<RefCell<Environment>>
pub fn enter_child_scope(&mut self) -> Rc<RefCell<Environment>>
Enter a child scope (new environment whose parent is the current env).
Returns the previous environment handle; pass it back to restore_env().
Sourcepub fn restore_env(&mut self, prev: Rc<RefCell<Environment>>)
pub fn restore_env(&mut self, prev: Rc<RefCell<Environment>>)
Restore a previously saved environment handle (typically from enter_child_scope()).
Sourcepub fn eval_program(&mut self, program: &Program) -> EvalResult
pub fn eval_program(&mut self, program: &Program) -> EvalResult
Evaluate a program
Sourcepub fn eval_statement(&mut self, stmt: &Stmt) -> EvalResult
pub fn eval_statement(&mut self, stmt: &Stmt) -> EvalResult
Evaluate a statement
Sourcepub fn eval_expression(&mut self, expr: &Expr) -> EvalResult
pub fn eval_expression(&mut self, expr: &Expr) -> EvalResult
Evaluate an expression