Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

pack

The pack module provides native binary serialization using the netidx Pack format. Like json::read, pack::read uses type-directed deserialization.

/// Decode a value from packed binary bytes.
///
/// To decode from a stream, read it first — `pack::read(Read::read_all(f)?)`.
val read: fn(input: bytes) -> Result<'b, [`PackErr(string), `InvalidCast(string)]>;

/// Encode a value to packed binary bytes.
///
/// To write to a stream, write the bytes — `Write::write_exact(f, pack::write_bytes(v)?)`.
val write_bytes: fn(value: Any) -> Result<bytes, `PackErr(string)>;

The Pack format is a compact binary encoding native to netidx. It is more space-efficient than JSON or TOML and supports the full range of Graphix types including bytes, datetime, and duration.