Struct rhai::EvalState[][src]

pub struct EvalState {
    pub source: Option<Identifier>,
    pub always_search: bool,
    pub scope_level: usize,
    pub operations: u64,
    pub modules: usize,
    pub resolver: Option<Shared<StaticModuleResolver>>,
    // some fields omitted
}
Expand description

(INTERNALS) A type that holds all the current states of the Engine. Exported under the internals feature only.

Volatile Data Structure

This type is volatile and may change.

Fields

source: Option<Identifier>

Source of the current context.

always_search: bool

Normally, access to variables are parsed with a relative offset into the scope to avoid a lookup. In some situation, e.g. after running an eval statement, subsequent offsets become mis-aligned. When that happens, this flag is turned on to force a scope lookup by name.

scope_level: usize

Level of the current scope. The global (root) level is zero, a new block (or function call) is one level higher, and so on.

operations: u64

Number of operations performed.

modules: usize

Number of modules loaded.

resolver: Option<Shared<StaticModuleResolver>>

Embedded module resolver.

Implementations

impl State[src]

pub fn is_global(&self) -> bool[src]

Is the state currently at global (root) level?

pub fn fn_resolution_cache_mut(
    &mut self
) -> &mut BTreeMap<u64, Option<Box<FnResolutionCacheEntry>>>
[src]

Get a mutable reference to the current function resolution cache.

pub fn push_fn_resolution_cache(&mut self)[src]

Push an empty function resolution cache onto the stack and make it current.

pub fn pop_fn_resolution_cache(&mut self)[src]

Remove the current function resolution cache from the stack and make the last one current.

Panics

Panics if there are no more function resolution cache in the stack.

Trait Implementations

impl Clone for State[src]

fn clone(&self) -> State[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for State[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for State[src]

fn default() -> State[src]

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

Auto Trait Implementations

impl !RefUnwindSafe for State

impl !Send for State

impl !Sync for State

impl Unpin for State

impl !UnwindSafe for State

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.