Ray's Knowledge Base

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-xml and scraper for DOCX, PPTX, EPUB and HTML (no pandoc); calamine, csv and parquet for tables; image and kamadak-exif for images; symphonia for media info; lopdf as the fallback PDF reader.
  • Allow C only where the Rust options are missing or poor: zstd-sys (compiled statically), SQLite through rusqlite with the bundled feature.
  • Keep external programs for what they do best and list them in rait doctor: Poppler, qpdf, ocrmypdf, tesseract, ffmpeg and curl.
  • Pin candle-core and candle-nn to =0.9.2: from 0.10, candle-core always pulls in tokenizers and 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-rust2 fixes 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 tokenizers and onig dependency, 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.