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§
sourcefn load(&self, specifier: &ModuleSpecifier, options: LoadOptions) -> LoadFuture
fn load(&self, specifier: &ModuleSpecifier, options: LoadOptions) -> LoadFuture
A method that given a specifier that asynchronously returns the source of the file.
Provided Methods§
sourcefn max_redirects(&self) -> usize
fn max_redirects(&self) -> usize
The maximum number of redirects allowed.
sourcefn get_cache_info(&self, _specifier: &ModuleSpecifier) -> Option<CacheInfo>
fn get_cache_info(&self, _specifier: &ModuleSpecifier) -> Option<CacheInfo>
An optional method which returns cache info for a module specifier.
sourcefn cache_module_info(
&self,
_specifier: &ModuleSpecifier,
_source: &Arc<[u8]>,
_module_info: &ModuleInfo
)
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.