Trait ModuleResolver

Source
pub trait ModuleResolver: Send + Sync {
    // Required methods
    fn resolve_import(
        &self,
        module_path: &str,
        from_file: &Path,
        base_dir: &Path,
    ) -> Result<ResolvedPath, ContextCreatorError>;
    fn get_file_extensions(&self) -> Vec<&'static str>;

    // Provided method
    fn is_external_module(&self, module_path: &str) -> bool { ... }
}
Expand description

Trait for language-specific module resolution

Required Methods§

Source

fn resolve_import( &self, module_path: &str, from_file: &Path, base_dir: &Path, ) -> Result<ResolvedPath, ContextCreatorError>

Resolve a module import to a file path

Source

fn get_file_extensions(&self) -> Vec<&'static str>

Get common file extensions for this language

Provided Methods§

Source

fn is_external_module(&self, module_path: &str) -> bool

Check if a module is likely external/third-party

Implementors§