rait prefers pure-Rust crates and allows C only where no good Rust option exists
DecisionVerified 28 Sep 2026Holds project: rait
Decision. The context, the choice, why, and the options that were turned down.
Context#
The user wants the rait binary to be self-contained "as much as possible" and prefers pure Rust. rait reads many formats and runs two vision models.
Decision#
- Use pure-Rust readers:
zip,quick-xmlandscraperfor DOCX, PPTX, EPUB and HTML (no pandoc);calamine,csvandparquetfor tables;imageandkamadak-exiffor images;symphoniafor media info; lopdf as the fallback PDF reader. - Allow C only where the Rust options are missing or poor:
zstd-sys(compiled statically), SQLite throughrusqlitewith thebundledfeature. - Keep external programs for what they do best and list them in
rait doctor: Poppler, qpdf, ocrmypdf, tesseract, ffmpeg and curl. - Pin
candle-coreandcandle-nnto=0.9.2: from 0.10, candle-core always pulls intokenizersand the Oniguruma C library. - Download models on demand with a pinned revision and SHA-256; never embed them in the binary.
- Vendor a patched crate when an upstream bug breaks a format:
vendor/sevenz-rust2fixes files dropped when a directory sits between files in a 7z solid block.
Why#
The user asked for a self-contained, mostly pure-Rust binary. A C dependency adds a compiler to every build and breaks cross checks: onig_sys failed cargo clippy --target x86_64-unknown-linux-gnu with failed to find tool "x86_64-linux-gnu-gcc" until candle was pinned.
Rejected options#
- candle 0.10 or 0.11: the forced
tokenizersandonigdependency, for a tokenizer rait does not use. - pandoc for documents: an external program the user did not want to need.
- Embedding model weights: about 230 MB in the binary for a feature that is optional.
Also found by searching
- cargo tree for rait shows a new C build dependency, should I add pandoc or a sys crate?
- I'm choosing crates for a document reader binary and want to know when C dependencies are acceptable
- which libraries should rait use for DOCX, tables, images and PDFs, pure Rust or C bindings?
- self-contained Rust binary policy: rusqlite bundled, zstd-sys allowed, no pandoc, models downloaded not embedded
- should I add a C dependency or pure Rust crate for reading docx or images in rait?
- which crates does rait use for PPTX EPUB HTML parquet and why no pandoc?
- rule for choosing between pure Rust and C libraries for a self-contained binary
- user wants binary self-contained as much as possible, when is C allowed