Expand description
docling.rs: a Rust port of docling.
The public surface mirrors the Python SDK, kept deliberately small:
use docling::{DocumentConverter, SourceDocument};
let converter = DocumentConverter::new();
let result = converter
.convert(SourceDocument::from_file("input.md").unwrap())
.unwrap();
println!("{}", result.document.export_to_markdown());For the PDF/image ML pipeline (pdfium + layout/TableFormer/OCR ONNX), reuse a
Pipeline across documents to amortize model loading, instead of the
per-call DocumentConverter. Deploying as a service: examples/Dockerfile
is a 3-stage build that bakes the binary, native libs, and exported models
(including the KV-cached TableFormer decoder) into a slim, Python-free runtime
image — see the “Deploy in a container” section of the README.
See MIGRATION.md for the architecture, the Python → Rust mapping, and the
phased plan. Phase 0 ships the converter plumbing plus Markdown and CSV
backends; PDF/DOCX/HTML and the ML pipeline land in later phases.
Modules§
- backend
- Format backends.
- chunker
- Document chunking for RAG pipelines — the Rust port of docling-core’s
docling_core.transforms.chunker. - dclx
.dclxpackaging: the DocLang OPC archive (doclang.packcounterpart).
Structs§
- Conversion
Result - The result of converting one
crate::SourceDocument. - Docling
Document - The unified, format-agnostic document produced by every backend.
- Document
Converter - Routes a
SourceDocumentto the backend for its format and returns aConversionResult. - Enrichment
Options - The opt-in enrichment passes, mirroring docling’s
PdfPipelineOptionsflags (do_picture_classification,do_code_enrichment,do_formula_enrichment). All off by default. - Markdown
Stream - An iterator over a document’s Markdown, yielded in document order as
conversion progresses. Each item is a chunk to write as-is; concatenating
every
Okchunk reproduces the buffered Markdown byte-for-byte. - Markdown
Streamer - Incremental Markdown serializer: feed finalized, in-document-order batches of
Nodes and receive Markdown chunks whose concatenation is byte-identical to [to_markdown_images] over the same nodes. This is the streaming counterpart of the buffered serializer — used to emit a document’s Markdown in chunks (e.g. page by page, as the parallel PDF pipeline finishes pages) instead of building the whole string up front. - Picture
Image - An extracted picture’s raw encoded bytes plus its mimetype and pixel size —
the docling.rs analogue of docling-core’s
ImageRef. - Pipeline
- A reusable PDF pipeline. The primary worker runs its models on every core, so a single-page / small / image / METS input is converted at full intra-op speed with no pool to load. A document with enough pages instead fans out across a pool of narrower workers processed concurrently. Both load lazily and are cached for reuse, so a one-shot conversion only pays for what it uses.
- Source
Document - A loaded input document: its name, detected format, and raw bytes.
- Table
- A simple row-major table. By default
rows[0]is the header row; aTableStructureoverlay overrides that and adds column spans.
Enums§
- Conversion
Error - Anything that can go wrong while loading or converting a source document.
- Conversion
Status - Outcome status of a conversion, mirroring
docling.datamodel.base_models.ConversionStatus. - DocItem
Label - Semantic role of a document item, mirroring docling-core’s
DocItemLabel. - Image
Mode - How pictures are rendered (mirrors docling-core’s
ImageRefMode). - Input
Format - A document format supported (or planned) by docling.rs backends.
- Node
- A single piece of document content.