Skip to main content

Module save

Module save 

Source
Expand description

§Saving Records to Disk

This module provides the writer-side of the framework. User types implement Save (or, for primitive-like leaves, Saveable) and obtain a Context from which they request side-car artifact writers and assemble a Record of named fields.

The generic entry point is save; save_to_disk (available under the disk feature) is the disk-backed convenience wrapper that serializes a value into a caller-chosen directory plus a manifest path.

§Building Records

The save_fields! macro is the idiomatic way to build a record from a struct or destructured enum variant. It handles per-field error context and invokes Saveable::save on each value.

§Side-Car Artifacts

Binary blobs (e.g. vector buffers) are written to side-car files via Context::write, which returns a Writer. The handle returned by Writer::finish can be embedded into the record as a Handle; it serializes as a $handle reference and is rehydrated on the load side.

Structs§

Context
A cheap, clonable handle threaded through every Save::save impl.
Error
Save-side error.
Handle
A reference to a side-car artifact in the manifest directory.
Keys
Iterator over the keys of a Record.
Record
A map of named Values.
Versioned
A Record paired with the schema Version used to produce it.
Writer
A borrowed side-car artifact writer produced by Context::write.

Enums§

Value
The wire-level union of every saveable kind.

Traits§

Save
Implemented by user types that map to a versioned Record.
Saveable
Implemented by any value that can be written into a Value.

Functions§

save_to_disk
Serialize x to disk.

Type Aliases§

Result
A specialized std::result::Result for save-side operations.