Skip to main content

verit/
lib.rs

1//! # verit — Exavian Veritate
2//!
3//! The **public umbrella crate**. One serialization format that is all three
4//! things at once — **zero-copy**, **self-describing**, and
5//! **schema-evolvable** — with no `unsafe`, an opt-in amplification-DoS budget,
6//! and one wire spec implemented byte-for-byte across six independent
7//! implementations (Rust, Python, C++, Go, TypeScript, and a GnuCOBOL port).
8//!
9//! Consumers depend only on `verit`. Everything real lives in the internal
10//! [`verit_core`] engine; this crate is the single public seam that re-exports
11//! it, so the engine can be split or rewritten from one edit point. The
12//! internal crates (`verit-core`, `verit-cli`) must never be imported directly.
13//!
14//! ```
15//! use verit::prelude::*;
16//!
17//! let schema = SchemaBuilder::new()
18//!     .add_struct("Point", vec![(1, "x", Dt::F64), (2, "y", Dt::F64)])
19//!     .build("Point")?;
20//! let bytes = encode(&schema, &Value::Struct(vec![
21//!     (1, Value::F64(1.5)), (2, Value::F64(-0.5)),
22//! ]), SchemaMode::Inline)?;
23//! assert_eq!(dump_json(&bytes)?, r#"{"x":1.5,"y":-0.5}"#);
24//! # Ok::<(), verit::Error>(())
25//! ```
26//!
27//! The wire format is specified in `docs/Architecture/VERIT - Wire
28//! Specification.md`; the crate map is in `VERIT - System Architecture.md`.
29
30// No `unsafe` anywhere — compiler-enforced, matching the engine it re-exports.
31#![forbid(unsafe_code)]
32
33// The whole public surface of the engine — types, functions, and the `codegen`
34// / `wire` modules that generated readers compile against — flows through here.
35#[doc(inline)]
36pub use verit_core::*;
37
38/// `#[derive(Verit)]` — generate a schema, encoder, and decoder from a plain
39/// Rust struct (the peer of Python's `@verit`). Available with the `derive`
40/// feature: `verit = { version = "…", features = ["derive"] }`. See
41/// [`VeritType`] for what it generates.
42#[cfg(feature = "derive")]
43pub use verit_derive::Verit;
44
45pub mod prelude;
46
47/// The crate version string, from `Cargo.toml`.
48pub const VERSION: &str = env!("CARGO_PKG_VERSION");