pub fn extract(path: &Path) -> Result<Extracted>Expand description
Extract plain text (and best-effort metadata) from a document, choosing the adapter by the file’s extension.
This is the single entry point the CLI calls. It reads exactly one file and
returns one Extracted; there is no whole-store walk here (per the
crate-wide O(changed) invariant — a store-wide extraction is the caller’s
loop). An unsupported extension is ExtractError::UnsupportedFormat; an
encrypted PDF is ExtractError::Encrypted; neither panics.
§Examples
use std::path::Path;
let out = dbmd_core::extract::extract(Path::new("sources/docs/invoice.pdf"))?;
println!("{}", out.text);