|
5 | 5 |
|
6 | 6 | //! Wire-level value types used in the on-disk manifest. |
7 | 7 | //! |
8 | | -//! Every saveable field is one of: |
| 8 | +//! These types are the shared currency of both halves of the framework: |
| 9 | +//! user value -> [`save`](crate::save) -> [`Value`] in the save path, and the |
| 10 | +//! [`Value`] -> [`load`](crate::load) -> user value in the load path. |
| 11 | +//! |
| 12 | +//! Every field stored in a manifest is one of: |
9 | 13 | //! |
10 | 14 | //! * [`Value::Null`] / [`Value::Bool`] / [`Value::Number`] / [`Value::String`] / |
11 | 15 | //! [`Value::Bytes`] — primitive scalars. |
12 | 16 | //! * [`Value::Array`] — a homogeneous sequence (used by `Vec<T>` and `&[T]`). |
13 | 17 | //! * [`Value::Object`] — a [`Versioned`] [`Record`] (the canonical encoding for a |
14 | | -//! `T: super::Save`). |
| 18 | +//! `T: crate::save::Save`). |
15 | 19 | //! * [`Value::Handle`] — a reference to a side-car artifact (produced by |
16 | | -//! [`super::Context::write`] + [`super::context::Writer::finish`]). |
| 20 | +//! [`crate::save::Context::write`] + [`crate::save::Writer::finish`]). |
17 | 21 | //! |
18 | | -//! Most user code never touches these enums directly: [`super::Saveable`] impls turn |
19 | | -//! Rust values into [`Value`]s, and the [`save_fields!`](crate::save_fields) macro |
20 | | -//! assembles the surrounding [`Record`]. |
| 22 | +//! Most user code never touches these enums directly. On the save side, |
| 23 | +//! [`crate::save::Saveable`] impls turn Rust values into [`Value`]s and the |
| 24 | +//! [`save_fields!`](crate::save_fields) macro assembles the surrounding [`Record`]; on |
| 25 | +//! the load side, the [`crate::load`] accessors walk the same [`Value`] tree back into |
| 26 | +//! Rust values. |
21 | 27 |
|
22 | 28 | use std::{borrow::Cow, collections::HashMap}; |
23 | 29 |
|
@@ -189,10 +195,11 @@ impl From<Handle> for Value<'_> { |
189 | 195 |
|
190 | 196 | /// A map of named [`Value`]s. |
191 | 197 | /// |
192 | | -/// `Record` is the body of a saved object: each call to [`super::Save::save`] returns |
193 | | -/// one, and [`Record::into_value`] wraps it as a [`Versioned`] [`Value::Object`] ready |
194 | | -/// for insertion into another record. Keys beginning with `$` are reserved for |
195 | | -/// framework metadata (see [`crate::is_reserved`]). |
| 198 | +/// `Record` is the body of an object in the manifest. On the save side each call to |
| 199 | +/// [`crate::save::Save::save`] returns one, and [`Record::into_value`] wraps it as a |
| 200 | +/// [`Versioned`] [`Value::Object`] ready for insertion into another record; on the load |
| 201 | +/// side the same record is read back through [`crate::load::Object`]. Keys beginning |
| 202 | +/// with `$` are reserved for framework metadata (see [`crate::is_reserved`]). |
196 | 203 | #[derive(Debug, Serialize, Deserialize)] |
197 | 204 | #[serde(transparent)] |
198 | 205 | pub struct Record<'a> { |
@@ -321,7 +328,7 @@ impl<'a> Versioned<'a> { |
321 | 328 |
|
322 | 329 | /// A reference to a side-car artifact in the manifest directory. |
323 | 330 | /// |
324 | | -/// Produced by [`Writer::finish`](super::Writer::finish) after a side-car write completes and |
| 331 | +/// Produced by [`Writer::finish`](crate::save::Writer::finish) after a side-car write completes and |
325 | 332 | /// inserted into a [`Record`] like any other value. Serializes as `{"$handle": "<name>"}` |
326 | 333 | /// on the wire; the load side rehydrates it through |
327 | 334 | /// [`crate::load::Object::read`]. |
|
0 commit comments