pub struct EvalContext {Show 15 fields
pub module_cache: RefCell<BTreeMap<PathBuf, BTreeMap<String, Value>>>,
pub current_file: RefCell<Vec<PathBuf>>,
pub module_exports: RefCell<Vec<Option<Vec<String>>>>,
pub module_load_stack: RefCell<Vec<PathBuf>>,
pub call_stack: RefCell<Vec<CallFrame>>,
pub span_table: RefCell<HashMap<usize, Span>>,
pub eval_depth: Cell<usize>,
pub eval_step_limit: Cell<usize>,
pub eval_steps: Cell<usize>,
pub sandbox: Sandbox,
pub user_context: RefCell<Vec<BTreeMap<Value, Value>>>,
pub hidden_context: RefCell<Vec<BTreeMap<Value, Value>>>,
pub context_stacks: RefCell<BTreeMap<Value, Vec<Value>>>,
pub eval_fn: Cell<Option<fn(&EvalContext, &Value, &Env) -> Result<Value, SemaError>>>,
pub call_fn: Cell<Option<fn(&EvalContext, &Value, &[Value]) -> Result<Value, SemaError>>>,
}Fields§
§module_cache: RefCell<BTreeMap<PathBuf, BTreeMap<String, Value>>>§current_file: RefCell<Vec<PathBuf>>§module_exports: RefCell<Vec<Option<Vec<String>>>>§module_load_stack: RefCell<Vec<PathBuf>>§call_stack: RefCell<Vec<CallFrame>>§span_table: RefCell<HashMap<usize, Span>>§eval_depth: Cell<usize>§eval_step_limit: Cell<usize>§eval_steps: Cell<usize>§sandbox: Sandbox§user_context: RefCell<Vec<BTreeMap<Value, Value>>>§context_stacks: RefCell<BTreeMap<Value, Vec<Value>>>§eval_fn: Cell<Option<fn(&EvalContext, &Value, &Env) -> Result<Value, SemaError>>>§call_fn: Cell<Option<fn(&EvalContext, &Value, &[Value]) -> Result<Value, SemaError>>>Implementations§
Source§impl EvalContext
impl EvalContext
pub fn new() -> EvalContext
pub fn new_with_sandbox(sandbox: Sandbox) -> EvalContext
pub fn push_file_path(&self, path: PathBuf)
pub fn pop_file_path(&self)
pub fn current_file_dir(&self) -> Option<PathBuf>
pub fn current_file_path(&self) -> Option<PathBuf>
pub fn get_cached_module( &self, path: &PathBuf, ) -> Option<BTreeMap<String, Value>>
pub fn cache_module(&self, path: PathBuf, exports: BTreeMap<String, Value>)
pub fn set_module_exports(&self, names: Vec<String>)
pub fn clear_module_exports(&self)
pub fn take_module_exports(&self) -> Option<Vec<String>>
pub fn begin_module_load(&self, path: &PathBuf) -> Result<(), SemaError>
pub fn end_module_load(&self, path: &PathBuf)
pub fn push_call_frame(&self, frame: CallFrame)
pub fn call_stack_depth(&self) -> usize
pub fn truncate_call_stack(&self, depth: usize)
pub fn capture_stack_trace(&self) -> StackTrace
pub fn merge_span_table(&self, spans: HashMap<usize, Span>)
pub fn lookup_span(&self, ptr: usize) -> Option<Span>
pub fn set_eval_step_limit(&self, limit: usize)
pub fn context_get(&self, key: &Value) -> Option<Value>
pub fn context_set(&self, key: Value, value: Value)
pub fn context_has(&self, key: &Value) -> bool
pub fn context_remove(&self, key: &Value) -> Option<Value>
pub fn context_all(&self) -> BTreeMap<Value, Value>
pub fn context_push_frame(&self)
pub fn context_push_frame_with(&self, bindings: BTreeMap<Value, Value>)
pub fn context_pop_frame(&self)
pub fn context_clear(&self)
pub fn context_stack_push(&self, key: Value, value: Value)
pub fn context_stack_get(&self, key: &Value) -> Vec<Value>
pub fn context_stack_pop(&self, key: &Value) -> Option<Value>
Trait Implementations§
Source§impl Default for EvalContext
impl Default for EvalContext
Source§fn default() -> EvalContext
fn default() -> EvalContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for EvalContext
impl !RefUnwindSafe for EvalContext
impl Send for EvalContext
impl !Sync for EvalContext
impl Unpin for EvalContext
impl UnsafeUnpin for EvalContext
impl UnwindSafe for EvalContext
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more