pub trait ModuleResolver: Clone + Default {
// Required methods
fn resolve(&self, module_name: &str) -> Result<String, ModuleError>;
fn get_path(&self, module_name: &str) -> Result<String, ModuleError>;
fn search_paths(&self) -> Vec<PathBuf>;
fn set_search_paths(&mut self, paths: Vec<PathBuf>);
// Provided methods
fn canonical_name<'a>(&self, module_path: &'a str) -> &'a str { ... }
fn is_immutable_module(&self, _module_path: &str) -> bool { ... }
}Expand description
Core interface for resolving mq module source code by name.
Required Methods§
Sourcefn resolve(&self, module_name: &str) -> Result<String, ModuleError>
fn resolve(&self, module_name: &str) -> Result<String, ModuleError>
Returns the source content of module_name.
Sourcefn get_path(&self, module_name: &str) -> Result<String, ModuleError>
fn get_path(&self, module_name: &str) -> Result<String, ModuleError>
Returns the canonical path string for module_name (for diagnostics / LSP).
Sourcefn search_paths(&self) -> Vec<PathBuf>
fn search_paths(&self) -> Vec<PathBuf>
Returns the filesystem directories this resolver searches.
Sourcefn set_search_paths(&mut self, paths: Vec<PathBuf>)
fn set_search_paths(&mut self, paths: Vec<PathBuf>)
Replaces the filesystem search directories.
Provided Methods§
Sourcefn canonical_name<'a>(&self, module_path: &'a str) -> &'a str
fn canonical_name<'a>(&self, module_path: &'a str) -> &'a str
Returns the short identifier to store the module under.
For most resolvers this is module_path unchanged. HTTP-based resolvers
strip the URL prefix and .mq suffix so that, for example,
github.com/alice/mymod.mq@v1.0 becomes "mymod".
Sourcefn is_immutable_module(&self, _module_path: &str) -> bool
fn is_immutable_module(&self, _module_path: &str) -> bool
Whether this module’s source is embedded in the current binary and therefore cannot change during the lifetime of an Engine.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".