tiny.preserves.@"packed"
Defined in tiny.preserves.
A binary encoding of values: a writer that turns a value into bytes, and a reader that turns bytes back into one value under limits the caller sets.
API (6)
Actions
Public operations.
decode: Returns the one value thatbytesencodes, allocated withallocator.encode: Returns the binary encoding ofvalueas new bytes allocated withallocator, for code that stores, sends or fingerprints a value.
Types and contracts
Public types and contracts.
Tag: The tag byte that starts each encoded value, as an enum overu8, so code that writes encoded bytes by hand names each tag through it.
Namespaces
Public namespaces.
constants: The tag bytes of the binary syntax, one per kind of value, plus the end marker.reader: Reads one value back from its binary encoding.writer: Writes values as bytes in a binary encoding.
Source
Source: lib/preserves/src/packed/root.zig
zig
//! A binary encoding of values: a writer that turns a value into bytes, and a reader that turns//! bytes back into one value under limits the caller sets.//!//! A caller that stores, sends or hashes values needs every equal value to encode to the same//! bytes, and needs to decode bytes from an untrusted peer within bounds on memory and recursion.//! For values free of embedded values, discards, captures, binds and rest patterns, writing then//! reading returns an equal value, and writing the result again returns the same bytes.//!//! The encoding is the binary syntax of the [Preserves](https://preserves.dev/) data language,//! which the package keeps. The writer is `encode` and the reader is `decode`, and the namespace//! also holds their files and the tag bytes (`Tag`).pub const constants = @import("constants.zig");pub const reader = @import("reader.zig");pub const writer = @import("writer.zig");pub const Tag = constants.Tag;pub const decode = reader.decode;pub const encode = writer.encode;Source: lib/preserves/src/root.zig:118
zig
pub const @"packed" = @import("packed/root.zig");Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |