pub trait DocumentLoader: Send + Sync {
// Required methods
fn supported_extensions(&self) -> Vec<&str>;
fn load(&self, path: &Path) -> Result<Document>;
// Provided method
fn can_load(&self, path: &Path) -> bool { ... }
}Expand description
Abstraction for loading files of any format into Documents.
Implementors handle format detection, parsing, and conversion
to the standard Document representation. A loader may support
multiple file extensions.
Required Methods§
Sourcefn supported_extensions(&self) -> Vec<&str>
fn supported_extensions(&self) -> Vec<&str>
File extensions this loader handles (lowercase, without dot).
Provided Methods§
Sourcefn can_load(&self, path: &Path) -> bool
fn can_load(&self, path: &Path) -> bool
Returns true if this loader can handle the given path.
Default implementation checks the file extension against
supported_extensions().