verit_core/lib.rs
1//! # Veritate
2//!
3//! One serialization format that is actually all three things at once:
4//!
5//! - **Zero-copy**: every field read is a bounds-checked indexed load straight
6//! from the message buffer. Strings and bytes come back as `&str` / `&[u8]`
7//! borrowing the buffer. No parse step, no allocation on the read path.
8//! - **Self-describing**: every message carries the 128-bit content hash of its
9//! writer schema, and can carry the full schema inline. A message plus
10//! nothing else is fully interpretable — see [`dump_json`].
11//! - **Schema-evolvable**: fields are identified by stable numeric IDs.
12//! Readers resolve (writer schema, reader schema) once into a cached
13//! [`Resolver`] access plan; added fields read as `None` for old readers'
14//! data, unknown fields cost nothing, renames are free, integer widening is
15//! converted on load.
16//!
17//! The trick that resolves the classic pick-two trilemma: the indirection that
18//! evolution needs is paid **once per schema pair**, not per message (protobuf
19//! tags, JSON keys) and not at build time (FlatBuffers codegen). See the architecture docs
20//! for the wire format.
21
22// The library contains no `unsafe`, by design (memory safety on untrusted bytes
23// rests on it) — enforced by the compiler, not just convention.
24#![forbid(unsafe_code)]
25
26pub mod codegen;
27pub mod container;
28pub mod derive;
29pub mod dump;
30pub mod encode;
31pub mod error;
32pub mod file;
33pub mod hash;
34pub mod idl;
35pub mod layout;
36pub mod message;
37pub mod registry;
38pub mod resolve;
39pub mod schema;
40pub mod value;
41pub mod wire;
42
43#[allow(deprecated)]
44pub use container::{Container, ContainerWriter};
45pub use derive::VeritType;
46pub use dump::{dump_json, dump_json_with};
47pub use encode::{encode, SchemaMode};
48pub use error::{Error, Result};
49pub use file::{
50 FileBuilder, FileReader, FileView, FileWriter, Footer, Record, Resolvers, FIRST_RECORD_ID,
51 OPT_RECORD_CRC,
52};
53pub use message::{Budget, ListReader, Message, Ref, StructReader};
54pub use registry::SchemaRegistry;
55pub use resolve::Resolver;
56pub use schema::{
57 Default, Dt, EnumDef, FieldDef, Schema, SchemaBuilder, StructDef, StructMode, Type, TypeDef,
58};
59pub use value::{Scalars, Value};