pub trait DocumentReader: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn supports(&self, hint: &ReaderHint<'_>) -> bool;
fn extract(
&self,
bytes: &[u8],
hint: &ReaderHint<'_>,
) -> Result<ReaderOutput>;
}Expand description
Trait implemented by document readers that can extract text from supported formats.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Human-readable name used for diagnostics (e.g., “document_processor”, “pdfium”).
Sourcefn supports(&self, hint: &ReaderHint<'_>) -> bool
fn supports(&self, hint: &ReaderHint<'_>) -> bool
Return true if this reader is a good match for the provided hint.
Sourcefn extract(&self, bytes: &[u8], hint: &ReaderHint<'_>) -> Result<ReaderOutput>
fn extract(&self, bytes: &[u8], hint: &ReaderHint<'_>) -> Result<ReaderOutput>
Extract text and metadata from the provided bytes.