Skip to content
SPDF 5.0

SPDF in Rust

How to install and use the Rust implementation of SPDF (spdf): open, validate, search and cite. Reference implementation; also provides the C ABI.

Reviewed Markdown

  • Package: spdf
  • Install: cargo add spdf
  • Registry: crates.io
  • Tier: first
  • CI: CI running
  • Folder: rust/

The README of this library is written in Spanish.

Espacio de trabajo Cargo con tres crates:

cratequé es
crates/spdfla biblioteca: apertura segura, lectura 5.0 y legado 4.x, validación, volcado canónico, búsqueda léxica, vectorial e híbrida, anclas y URI, cita corta, CSL-JSON y BibTeX, escritor, conversión del legado, integridad y firma, lectura remota por rangos HTTP (--features http, experimental)
crates/spdf-toolsla CLI spdf
crates/spdf-ffila ABI de C estable (include/spdf.h)

SQLite va empaquetado (rusqlite con bundled): la misma versión y el mismo FTS5 en macOS, Linux, Windows, iOS y Android.

Uso rápido

cd rust
cargo build --release
./target/release/spdf validate ../conformance/files/quijote.spdf
./target/release/spdf search ../conformance/files/quijote.spdf --lexical hidalgo
./target/release/spdf conformance ../conformance > conformance.json

Desde otro crate del repositorio (por ejemplo el lector Tauri):

spdf = { path = "../../rust/crates/spdf" }

Pruebas

cargo test --workspace --all-features   # unitarias, de propiedades, de API, remotas, conformidad y doctests
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo fmt --all -- --check
cargo bench -p spdf --features http     # véase RENDIMIENTO.md

La prueba tests/conformance.rs ejecuta toda la batería de ../conformance/cases; el CI (.github/workflows/rust.yml) la corre en Linux, macOS y Windows y sube el informe como artefacto conformance-rust.

Documentos

Licencia: MIT OR Apache-2.0.