pub struct MemoryWrite<'a> {
pub scope: &'a str,
pub kind: MemoryKind,
pub anchor: Option<&'a str>,
pub body: &'a str,
pub confidence: Option<f64>,
pub supersedes: Option<i64>,
}Expand description
The values crate::Store::record_memory writes.
anchor is a node key; the blob and path stored alongside it are captured
by the store from the graph at write time, so there is exactly one place that
decides what an anchor’s evidence is. tree is captured the same way.
Fields§
§scope: &'a strThe scope to record.
kind: MemoryKindWhat kind of knowledge this is.
anchor: Option<&'a str>The node key to anchor to, if any. A key naming no node is accepted,
and reads back as AnchorState::Vanished: recording a lesson about code
that is already gone is a legitimate — often the most valuable — thing to
do, and refusing it would be the prune rule wearing a different hat.
body: &'a strThe prose.
confidence: Option<f64>The writer’s own confidence, if it has one.
supersedes: Option<i64>The record this one overrules, if any. Supersession is recorded here, explicitly, at the moment the successor is written — never inferred later from age.
Implementations§
Source§impl MemoryWrite<'_>
impl MemoryWrite<'_>
Sourcepub fn validate(&self) -> Result<(), MemoryError>
pub fn validate(&self) -> Result<(), MemoryError>
Validate a write, refusing a record that could not be stored or recalled.
§Errors
Returns MemoryError::InvalidScope, MemoryError::InvalidBody or
MemoryError::InvalidConfidence, each naming what was actually wrong.
Trait Implementations§
Source§impl<'a> Clone for MemoryWrite<'a>
impl<'a> Clone for MemoryWrite<'a>
Source§fn clone(&self) -> MemoryWrite<'a>
fn clone(&self) -> MemoryWrite<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more