Trait deno_emit::Loader

source ·
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§

source

fn load( &mut self, specifier: &Url, is_dynamic: bool, cache_setting: CacheSetting ) -> Pin<Box<dyn Future<Output = Result<Option<LoadResponse>, Error>>>>

A method that given a specifier that asynchronously returns the source of the file.

Provided Methods§

source

fn registry_url(&self) -> &Url

source

fn registry_package_url(&self, nv: &PackageNv) -> Url

source

fn registry_package_url_to_nv(&self, url: &Url) -> Option<PackageNv>

source

fn get_cache_info(&self, _specifier: &Url) -> Option<CacheInfo>

An optional method which returns cache info for a module specifier.

source

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.

Implementors§