substrate-data 0.3.0

One data model, text syntax, binary form, packed frames and schema system — for any program's files, saves and wire messages.
Documentation
//! The binary form — self-describing, compact: what a build compiles
//! content to, what saves and caches are kept in, what a reader that
//! doesn't know the schema can still walk. `docs/format.md` ("Binary form")
//! has the layout: a header (`SDAT`, a version byte), then the root value,
//! a tag byte and its payload. A string is written where it's first used
//! and referred to after that, so repeated keys and ids cost one varint
//! each and the writer never goes back over what it wrote.
//!
//! Nothing is aligned, and decoding checks every length against the
//! input, so malformed bytes are an error, never a panic or a huge
//! allocation. A [`crate::Schema`] writes itself here straight
//! ([`crate::Schema::encode`]) and reads itself back the same way
//! ([`crate::Schema::decode`]) — no value tree on the way.

mod codec;
mod decode;
mod layout;
pub(crate) mod table;
pub mod tag;
#[cfg(test)]
mod tests;
mod varint;
mod write;

pub use codec::{decode, decode_ref, encode, encode_into, upgrade};
pub use decode::{DecodeError, Decoder};
pub use layout::{
    INLINE_INT_MAX, INLINE_INT_MIN, LEGACY_VERSION, MAGIC, MAX_DEPTH, NEW_STRING, STR_INDEX_COUNT,
    STREAM_LEN_BYTES, VERSION,
};
pub(crate) use varint::{
    VARINT_BITS, VARINT_LAST_SHIFT, VARINT_MAX_SHIFT, VARINT_MORE, VARINT_SHIFT, read_varint,
    unzigzag, varint, zigzag,
};
pub use write::Writer;
pub(crate) use write::writer;