pub trait ModuleResolver: Default {
// Required method
fn name_to_resource(
&self,
name: &Identifier,
imported_by: Option<FileId>,
) -> Result<Url, Error>;
// Provided method
fn path_name_to_resource(
&self,
name: &ModulePath,
imported_by: Option<FileId>,
) -> Result<Url, Error> { ... }
}
Expand description
A resolver implementation is responsible for determining the resource identifier (URL) for
a module named name
.
The additional parameter imported_by
identifies the module source making the request.
Required Methods§
Sourcefn name_to_resource(
&self,
name: &Identifier,
imported_by: Option<FileId>,
) -> Result<Url, Error>
fn name_to_resource( &self, name: &Identifier, imported_by: Option<FileId>, ) -> Result<Url, Error>
Return a URL given the module name name
.
Provided Methods§
fn path_name_to_resource( &self, name: &ModulePath, imported_by: Option<FileId>, ) -> Result<Url, Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.