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§
Provided Methods§
Sourcefn document(&mut self, path: &RepoPath) -> Result<Option<Document>>
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).
Sourcefn full_document(&mut self, path: &RepoPath) -> Result<Document>
fn full_document(&mut self, path: &RepoPath) -> Result<Document>
full_document reads and parses one document, whatever the cache holds.
Sourcefn additional(&mut self, path: &RepoPath) -> Result<Option<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).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".