Struct rant::DefaultModuleResolver
source · [−]pub struct DefaultModuleResolver {
pub enable_global_modules: bool,
pub local_modules_path: Option<String>,
}
Expand description
The default filesystem-based module resolver.
Resolution strategy
This resolver uses the following strategy to locate module files:
- If triggered by a program, the program’s containing directory is searched first.
- The directory specified in
local_modules_path
is searched next. If not specified, uses the host application’s current working directory. - If
enable_global_modules
is set totrue
, the global modules path is searched.
Fields
enable_global_modules: bool
Enables loading modules from RANT_MODULES_PATH.
local_modules_path: Option<String>
Specifies a preferred module loading path with higher precedence than the global module path. If not specified, looks in the current working directory.
Implementations
sourceimpl DefaultModuleResolver
impl DefaultModuleResolver
sourcepub const ENV_MODULES_PATH_KEY: &'static str = "RANT_MODULES_PATH"
pub const ENV_MODULES_PATH_KEY: &'static str = "RANT_MODULES_PATH"
The name of the environment variable that used to provide the global modules path.
Trait Implementations
sourceimpl Debug for DefaultModuleResolver
impl Debug for DefaultModuleResolver
sourceimpl Default for DefaultModuleResolver
impl Default for DefaultModuleResolver
sourceimpl ModuleResolver for DefaultModuleResolver
impl ModuleResolver for DefaultModuleResolver
fn try_resolve(
&self,
context: &mut Rant,
module_path: &str,
dependant: Option<&RantProgramInfo>
) -> ModuleResolveResult
Auto Trait Implementations
impl RefUnwindSafe for DefaultModuleResolver
impl Send for DefaultModuleResolver
impl Sync for DefaultModuleResolver
impl Unpin for DefaultModuleResolver
impl UnwindSafe for DefaultModuleResolver
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more