Skip to content

Commit 5ca175c

Browse files
committed
moved up one level since both load/save paths use them
1 parent f064610 commit 5ca175c

3 files changed

Lines changed: 22 additions & 13 deletions

File tree

diskann-record/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ pub use number::Number;
8686
mod version;
8787
pub use version::Version;
8888

89+
mod value;
90+
pub use value::{Handle, Keys, Record, Value, Versioned};
91+
8992
pub mod load;
9093
pub mod save;
9194

diskann-record/src/save/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
//! [`Context::write`], which returns a [`Writer`]. The handle returned by
2525
//! [`Writer::finish`](context::Writer::finish) can be embedded into the record as a
2626
//! [`Handle`]; it serializes as a `$handle` reference and is rehydrated on the load side.
27-
mod value;
28-
pub use value::{Handle, Keys, Record, Value, Versioned};
27+
pub use crate::value::{Handle, Keys, Record, Value, Versioned};
2928

3029
mod context;
3130
pub use context::{Context, Writer};
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@
55

66
//! Wire-level value types used in the on-disk manifest.
77
//!
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:
913
//!
1014
//! * [`Value::Null`] / [`Value::Bool`] / [`Value::Number`] / [`Value::String`] /
1115
//! [`Value::Bytes`] — primitive scalars.
1216
//! * [`Value::Array`] — a homogeneous sequence (used by `Vec<T>` and `&[T]`).
1317
//! * [`Value::Object`] — a [`Versioned`] [`Record`] (the canonical encoding for a
14-
//! `T: super::Save`).
18+
//! `T: crate::save::Save`).
1519
//! * [`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`]).
1721
//!
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.
2127
2228
use std::{borrow::Cow, collections::HashMap};
2329

@@ -189,10 +195,11 @@ impl From<Handle> for Value<'_> {
189195

190196
/// A map of named [`Value`]s.
191197
///
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`]).
196203
#[derive(Debug, Serialize, Deserialize)]
197204
#[serde(transparent)]
198205
pub struct Record<'a> {
@@ -321,7 +328,7 @@ impl<'a> Versioned<'a> {
321328

322329
/// A reference to a side-car artifact in the manifest directory.
323330
///
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
325332
/// inserted into a [`Record`] like any other value. Serializes as `{"$handle": "<name>"}`
326333
/// on the wire; the load side rehydrates it through
327334
/// [`crate::load::Object::read`].

0 commit comments

Comments
 (0)