pub trait Loader {
// Required method
fn load(
&mut self,
specifier: &Url,
is_dynamic: bool,
cache_setting: CacheSetting
) -> Pin<Box<dyn Future<Output = Result<Option<LoadResponse>, Error>>>>;
// Provided methods
fn registry_url(&self) -> &Url { ... }
fn registry_package_url(&self, nv: &PackageNv) -> Url { ... }
fn registry_package_url_to_nv(&self, url: &Url) -> Option<PackageNv> { ... }
fn get_cache_info(&self, _specifier: &Url) -> Option<CacheInfo> { ... }
fn cache_module_info(
&mut self,
_specifier: &Url,
_source: &str,
_module_info: &ModuleInfo
) { ... }
}
Expand description
A trait which allows asynchronous loading of source files into a module graph in a thread safe way as well as a way to provide additional meta data about any cached resources.
Required Methods§
Provided Methods§
fn registry_url(&self) -> &Url
fn registry_package_url(&self, nv: &PackageNv) -> Url
fn registry_package_url_to_nv(&self, url: &Url) -> Option<PackageNv>
sourcefn get_cache_info(&self, _specifier: &Url) -> Option<CacheInfo>
fn get_cache_info(&self, _specifier: &Url) -> Option<CacheInfo>
An optional method which returns cache info for a module specifier.
sourcefn cache_module_info(
&mut self,
_specifier: &Url,
_source: &str,
_module_info: &ModuleInfo
)
fn cache_module_info( &mut self, _specifier: &Url, _source: &str, _module_info: &ModuleInfo )
Cache the module info for the provided specifier if the loader supports caching this information.