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 method
fn canonical_name<'a>(&self, module_path: &'a str) -> &'a str { ... }
}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".
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".