Skip to main content

Loader

Trait Loader 

Source
pub trait Loader {
    // Required method
    fn load(&mut self, path: &RepoPath) -> Result<Source>;

    // Provided methods
    fn parse(&mut self, source: &Source, mode: ParseMode) -> Parsed { ... }
    fn document(&mut self, path: &RepoPath) -> Result<Option<Document>> { ... }
    fn full_document(&mut self, path: &RepoPath) -> Result<Document> { ... }
    fn additional(&mut self, path: &RepoPath) -> Result<Option<Source>> { ... }
    fn schema(&mut self, path: &RepoPath) -> Result<Option<Document>> { ... }
    fn index(&mut self, path: &RepoPath) -> Result<Option<IndexFile>> { ... }
}
Expand description

A Loader reads files and parses them. An implementation can put a cache behind it.

Required Methods§

Source

fn load(&mut self, path: &RepoPath) -> Result<Source>

load reads one file.

Provided Methods§

Source

fn parse(&mut self, source: &Source, mode: ParseMode) -> Parsed

parse parses one source.

Source

fn document(&mut self, path: &RepoPath) -> Result<Option<Document>>

document reads and parses one document. When a cache is behind the loader, document returns None for an unchanged document whose results the cache already holds, until a check needs the document (CACHE-1_AC-20).

Source

fn full_document(&mut self, path: &RepoPath) -> Result<Document>

full_document reads and parses one document, whatever the cache holds.

Source

fn additional(&mut self, path: &RepoPath) -> Result<Option<Source>>

additional reads the text of one additional file. When a cache is behind the loader, additional returns None for an unchanged file until a check needs the file (CACHE-1_AC-20).

Source

fn schema(&mut self, path: &RepoPath) -> Result<Option<Document>>

schema reads and parses one schema document. When a cache is behind the loader, schema returns None for an unchanged schema until a check needs the schema compiled (CACHE-1_AC-25).

Source

fn index(&mut self, path: &RepoPath) -> Result<Option<IndexFile>>

index reads one index file. When a cache is behind the loader, index returns None for an unchanged index file until the check of the file’s directory needs the file (CACHE-1_AC-19).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§