Skip to main content

Module load

Module load 

Source
Expand description

§Loading Records from Disk

This module mirrors the super::save side. User types implement Load (or, for primitive-like leaves, Loadable) and obtain an Object / Context from which they extract individual fields and side-car artifacts.

The generic entry point is load; load_from_disk (available under the disk feature) is the disk-backed convenience wrapper that reads a manifest and dispatches into the user type’s Load impl.

§Reading Records

The load_fields! macro is the idiomatic way to extract a fixed set of named fields from an Object into local bindings. It mirrors the structure of save_fields!.

§Version Dispatch

Each Load impl declares a VERSION. If the version stored in the manifest matches, Load::load is called. Otherwise Load::load_legacy is invoked so the impl can perform a custom upgrade; returning an error::Kind::UnknownVersion from load_legacy indicates the loader has no upgrade path for that schema.

§Recoverable vs. Critical Errors

Load errors are tagged as recoverable or critical. Probing call sites that try multiple loaders should only retry when Error::is_recoverable returns true. See error::Kind::is_recoverable for the classification.

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

error
Load-side error type and classification.

Structs§

Context
A cheap, clonable handle threaded through every load impl.
Object
A versioned record reached through Context::as_object.
Reader
A borrowed reader over a side-car artifact.

Traits§

Load
Implemented by user types that can be reloaded from a versioned Object.
Loadable
Implemented by any value that can be deserialized from a Context.

Functions§

load_from_disk
Reload a value previously written by save::save_to_disk.