Skip to main content

FileReader

Trait FileReader 

Source
pub trait FileReader: Send + Sync {
    // Required methods
    fn extensions(&self) -> &[&str];
    fn read(&self, path: &Path) -> Result<Option<DocumentSource>>;
}

Required Methods§

Source

fn extensions(&self) -> &[&str]

File extensions this reader handles, without the leading dot (e.g. ["txt", "md"] or ["pdf"]).

Source

fn read(&self, path: &Path) -> Result<Option<DocumentSource>>

Read a single file and return its content as a DocumentSource. Return Ok(None) to silently skip the file (e.g. empty or non-UTF-8).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§