pub struct StaticModuleResolver(_);
Expand description

A static module resolution service that serves modules added into it.

Example

use rhai::{Engine, Module};
use rhai::module_resolvers::StaticModuleResolver;

let mut resolver = StaticModuleResolver::new();

let module = Module::new();
resolver.insert("hello", module);

let mut engine = Engine::new();

engine.set_module_resolver(resolver);

Implementations

Create a new StaticModuleResolver.

Example
use rhai::{Engine, Module};
use rhai::module_resolvers::StaticModuleResolver;

let mut resolver = StaticModuleResolver::new();

let module = Module::new();
resolver.insert("hello", module);

let mut engine = Engine::new();
engine.set_module_resolver(resolver);

Add a module keyed by its path.

Remove a module given its path.

Does the path exist?

Get an iterator of all the modules.

Get a mutable iterator of all the modules.

Get an iterator of all the module paths.

Get an iterator of all the modules.

Remove all modules.

Is this StaticModuleResolver empty?

Get the number of modules in this StaticModuleResolver.

Merge another StaticModuleResolver into this. The other StaticModuleResolver is consumed.

Existing modules of the same path name are overwritten.

Trait Implementations

Performs the += operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Resolve a module based on a path string.

Resolve a module based on a path string, given a GlobalRuntimeState. Read more

Resolve an AST based on a path string. 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

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

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.