Skip to main content

EvalContext

Struct EvalContext 

Source
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>>>§hidden_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

Source

pub fn new() -> EvalContext

Source

pub fn new_with_sandbox(sandbox: Sandbox) -> EvalContext

Source

pub fn push_file_path(&self, path: PathBuf)

Source

pub fn pop_file_path(&self)

Source

pub fn current_file_dir(&self) -> Option<PathBuf>

Source

pub fn current_file_path(&self) -> Option<PathBuf>

Source

pub fn get_cached_module( &self, path: &PathBuf, ) -> Option<BTreeMap<String, Value>>

Source

pub fn cache_module(&self, path: PathBuf, exports: BTreeMap<String, Value>)

Source

pub fn set_module_exports(&self, names: Vec<String>)

Source

pub fn clear_module_exports(&self)

Source

pub fn take_module_exports(&self) -> Option<Vec<String>>

Source

pub fn begin_module_load(&self, path: &PathBuf) -> Result<(), SemaError>

Source

pub fn end_module_load(&self, path: &PathBuf)

Source

pub fn push_call_frame(&self, frame: CallFrame)

Source

pub fn call_stack_depth(&self) -> usize

Source

pub fn truncate_call_stack(&self, depth: usize)

Source

pub fn capture_stack_trace(&self) -> StackTrace

Source

pub fn merge_span_table(&self, spans: HashMap<usize, Span>)

Source

pub fn lookup_span(&self, ptr: usize) -> Option<Span>

Source

pub fn set_eval_step_limit(&self, limit: usize)

Source

pub fn context_get(&self, key: &Value) -> Option<Value>

Source

pub fn context_set(&self, key: Value, value: Value)

Source

pub fn context_has(&self, key: &Value) -> bool

Source

pub fn context_remove(&self, key: &Value) -> Option<Value>

Source

pub fn context_all(&self) -> BTreeMap<Value, Value>

Source

pub fn context_push_frame(&self)

Source

pub fn context_push_frame_with(&self, bindings: BTreeMap<Value, Value>)

Source

pub fn context_pop_frame(&self)

Source

pub fn context_clear(&self)

Source

pub fn hidden_get(&self, key: &Value) -> Option<Value>

Source

pub fn hidden_set(&self, key: Value, value: Value)

Source

pub fn hidden_has(&self, key: &Value) -> bool

Source

pub fn hidden_push_frame(&self)

Source

pub fn hidden_pop_frame(&self)

Source

pub fn context_stack_push(&self, key: Value, value: Value)

Source

pub fn context_stack_get(&self, key: &Value) -> Vec<Value>

Source

pub fn context_stack_pop(&self, key: &Value) -> Option<Value>

Trait Implementations§

Source§

impl Default for EvalContext

Source§

fn default() -> EvalContext

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more