Skip to main content

LanguageResolver

Trait LanguageResolver 

Source
pub trait LanguageResolver: Send + Sync {
    // Required methods
    fn resolve(
        &self,
        import: &ImportStatement,
        importing_file: &str,
        file_index: &FileIndex,
    ) -> Option<String>;
    fn language(&self) -> Language;
    fn name(&self) -> &'static str;
}
Expand description

Trait for language-specific import resolution.

Each implementation maps an ImportStatement from a source file to a repo-relative file path, using the FileIndex for existence checks.

Required Methods§

Source

fn resolve( &self, import: &ImportStatement, importing_file: &str, file_index: &FileIndex, ) -> Option<String>

Resolve an import statement from importing_file into a repo-relative file path that exists in file_index. Return None if resolution fails or the import is external.

Source

fn language(&self) -> Language

The language(s) this resolver handles.

Source

fn name(&self) -> &'static str

A short human-readable name for debugging and logging.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§