pub struct GlobalRuntimeState {
    pub lib: StaticVec<Shared<Module>>,
    pub source: Option<ImmutableString>,
    pub num_operations: u64,
    pub num_modules_loaded: usize,
    pub level: usize,
    pub scope_level: usize,
    pub always_search_scope: bool,
    pub embedded_module_resolver: Option<Shared<StaticModuleResolver>>,
    pub constants: Option<Shared<Locked<BTreeMap<ImmutableString, Dynamic>>>>,
    pub tag: Dynamic,
    /* private fields */
}
Expand description

(internals) Global runtime states. Exported under the internals feature only.

Fields§

§lib: StaticVec<Shared<Module>>

The current stack of loaded modules containing script-defined functions.

§source: Option<ImmutableString>

Source of the current context.

No source if the string is empty.

§num_operations: u64

Number of operations performed.

§num_modules_loaded: usize

Number of modules loaded.

§level: usize

The current nesting level of function calls.

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

§always_search_scope: bool

Force a Scope search by name.

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, or after a custom syntax statement, subsequent offsets may become mis-aligned.

When that happens, this flag is turned on.

§embedded_module_resolver: Option<Shared<StaticModuleResolver>>

Embedded module resolver.

§constants: Option<Shared<Locked<BTreeMap<ImmutableString, Dynamic>>>>

Cache of globally-defined constants.

Interior mutability is needed because it is shared in order to aid in cloning.

§tag: Dynamic

Custom state that can be used by the external host.

Implementations§

Create a new GlobalRuntimeState based on an Engine.

Get the length of the stack of globally-imported modules.

Not available under no_module.

Get the globally-imported module at a particular index.

Not available under no_module.

Get the index of a globally-imported module by name.

Not available under no_module.

Push an imported module onto the stack.

Not available under no_module.

Truncate the stack of globally-imported modules to a particular length.

Not available under no_module.

Get an iterator to the stack of globally-imported modules in reverse order.

Not available under no_module.

Get an iterator to the stack of globally-imported modules in forward order.

Not available under no_module.

Does the specified function hash key exist in the stack of globally-imported modules?

Not available under no_module.

Get the specified function via its hash key from the stack of globally-imported modules.

Not available under no_module.

Does the specified TypeId iterator exist in the stack of globally-imported modules?

Not available under no_module.

Get the specified TypeId iterator from the stack of globally-imported modules.

Not available under no_module.

Get the current source.

Return a reference to the debugging interface.

Panics

Panics if the debugging interface is not set.

Return a mutable reference to the debugging interface.

Panics

Panics if the debugging interface is not set.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.