Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

StaticModuleResolver

Useful for no-std

StaticModuleResolver is often used with no_std in embedded environments without a file system.

Loads modules that are statically added.

Functions are searched in the global namespace by default.

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

let module: Module = create_a_module();

let mut resolver = StaticModuleResolver::new();
resolver.insert("my_module", module);

engine.set_module_resolver(resolver);