pub struct Loaded {
pub records: Vec<ReasoningRecord>,
pub unreadable: Vec<String>,
}Expand description
The records of a store, read.
Records are kept in canonical order, recorded_at then id, and every query of this
module reads them in that order. A file that does not parse, or that carries another
schema or version, is listed in unreadable instead of being dropped silently. The
default is the empty store, which is what admission sees before anything is written.
use majordomus_cli::reasoning::store::{Loaded, Store};
let dir = tempfile::tempdir().unwrap();
let task = dir.path().join(".ai/local/state/reasoning/t");
std::fs::create_dir_all(&task).unwrap();
std::fs::write(task.join("broken.json"), "{ not json").unwrap();
let loaded: Loaded = Store::at(dir.path()).load();
assert!(loaded.records.is_empty());
assert_eq!(loaded.unreadable, ["t/broken.json"]);Fields§
§records: Vec<ReasoningRecord>Every record that parsed, ordered by recorded_at then id.
unreadable: Vec<String>Files that did not parse, by path relative to the store.
Implementations§
Source§impl Loaded
impl Loaded
Sourcepub fn get(&self, id: &str) -> Option<&ReasoningRecord>
pub fn get(&self, id: &str) -> Option<&ReasoningRecord>
The record with this id, or None when no loaded record carries it.
Ids are unique in a store, so the first match is the only one.
use majordomus_cli::reasoning::record::*;
use majordomus_cli::reasoning::store::Loaded;
let mut loaded = Loaded::default();
loaded.records.push(ReasoningRecord {
schema: RECORD_SCHEMA.into(),
version: RECORD_VERSION,
id: "assessment-1".into(),
task: "t".into(),
recorded_at: "2026-10-01T00:00:01Z".into(),
head: None,
redacted: vec![],
body: ReasoningBody::Assessment(AssessmentInput::default()),
});
assert_eq!(loaded.get("assessment-1").map(|r| r.body.kind()), Some("assessment"));
assert!(loaded.get("assessment-2").is_none());Trait Implementations§
Auto Trait Implementations§
impl Freeze for Loaded
impl RefUnwindSafe for Loaded
impl Send for Loaded
impl Sync for Loaded
impl Unpin for Loaded
impl UnsafeUnpin for Loaded
impl UnwindSafe for Loaded
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more