Trait deno_graph::source::Loader

source ·
pub trait Loader {
    // Required method
    fn load(
        &self,
        specifier: &ModuleSpecifier,
        options: LoadOptions
    ) -> LoadFuture;

    // Provided methods
    fn max_redirects(&self) -> usize { ... }
    fn get_cache_info(&self, _specifier: &ModuleSpecifier) -> Option<CacheInfo> { ... }
    fn cache_module_info(
        &self,
        _specifier: &ModuleSpecifier,
        _source: &Arc<[u8]>,
        _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(&self, specifier: &ModuleSpecifier, options: LoadOptions) -> LoadFuture

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

Provided Methods§

source

fn max_redirects(&self) -> usize

The maximum number of redirects allowed.

source

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

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

source

fn cache_module_info( &self, _specifier: &ModuleSpecifier, _source: &Arc<[u8]>, _module_info: &ModuleInfo )

Cache the module info for the provided specifier if the loader supports caching this information.

Implementors§