pub struct MemoryEntry {
pub key: String,
pub value: String,
pub run_id: i64,
pub step: u32,
pub created_at: String,
}Expand description
One durable memory entry: a fact or decision an agent wrote deliberately, keyed to a workspace rather than to a run.
use io_harness::Store;
let store = Store::memory()?;
let first = store.start_run("make the tests pass", "src/lib.rs")?;
// What an agent learned the expensive way, written once so the next run over
// this workspace does not spend three steps rediscovering it.
store.memory_put("/repo", "test-command", "cargo test --features documents", first, 6)?;
// A later run — a different process, days afterwards — recalls it by key.
let entry = store.memory_get("/repo", "test-command")?.expect("written above");
assert_eq!(entry.value, "cargo test --features documents");
// Attributed, which is what makes a stale fact traceable: this came from run
// 1, step 6, and you can go and read what that step actually did.
assert_eq!((entry.run_id, entry.step), (first, 6));
// Keyed to the workspace, never to the run: another workspace sees nothing.
assert!(store.memory_get("/other-repo", "test-command")?.is_none());Fields§
§key: StringThe name it is recalled by, unique within its workspace.
value: StringThe remembered text.
run_id: i64The run that wrote it, so a later reader knows where a fact came from.
step: u32The step of that run which wrote it.
created_at: StringUTC write time, refreshed on every overwrite so ordering is by recency.
Trait Implementations§
Source§impl Clone for MemoryEntry
impl Clone for MemoryEntry
Source§fn clone(&self) -> MemoryEntry
fn clone(&self) -> MemoryEntry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryEntry
impl Debug for MemoryEntry
Source§impl PartialEq for MemoryEntry
impl PartialEq for MemoryEntry
impl StructuralPartialEq for MemoryEntry
Auto Trait Implementations§
impl Freeze for MemoryEntry
impl RefUnwindSafe for MemoryEntry
impl Send for MemoryEntry
impl Sync for MemoryEntry
impl Unpin for MemoryEntry
impl UnsafeUnpin for MemoryEntry
impl UnwindSafe for MemoryEntry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.