Skip to main content

ModuleResolver

Trait ModuleResolver 

Source
pub trait ModuleResolver: Send + Sync {
    // Required method
    fn resolve(
        &self,
        path: &str,
        scope: &Arc<Scope>,
        range: TokenRange,
    ) -> Result<Option<ModuleSource>, RuntimeError>;
}
Expand description

A pluggable resolver that answers @import("path") requests.

Resolvers are polled in order; the first non-None return value is used. Returning Ok(None) defers to the next resolver. Returning Err(_) aborts the import without consulting later resolvers.

Required Methods§

Source

fn resolve( &self, path: &str, scope: &Arc<Scope>, range: TokenRange, ) -> Result<Option<ModuleSource>, RuntimeError>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§