pub struct MemoryWrite { /* private fields */ }Expand description
What a session is handing to memory in one go.
Entries and their reasons travel together because they are one thought. A write that landed the entries and lost the edges would leave memory that reads correctly and cannot be followed, which is the failure that looks least like a failure.
Implementations§
Source§impl MemoryWrite
impl MemoryWrite
Sourcepub fn new(
entries: Vec<MemoryEntry>,
relations: Vec<MemoryRelation>,
) -> Result<Self, DomainError>
pub fn new( entries: Vec<MemoryEntry>, relations: Vec<MemoryRelation>, ) -> Result<Self, DomainError>
Entries, and the reasons connecting them.
A write carrying neither is refused here rather than by each backend in turn: it is a call that would change nothing, and a backend answering “remembered” to it would be lying quietly. Refusing at construction means no backend is ever handed one.
Relations may point outside this write. An ending explains a decision taken an hour ago, and whether that decision is still there is the backend’s to say, not this type’s — it cannot see what memory already holds.
Sourcepub fn reasons_only(relations: Vec<MemoryRelation>) -> Result<Self, DomainError>
pub fn reasons_only(relations: Vec<MemoryRelation>) -> Result<Self, DomainError>
Reasons about things already remembered.
The shape a caller needs when the understanding arrives after the events: both ends were written earlier, and what is new is the edge between them. Whether those ends are still there is the backend’s to judge, not this type’s.
Sourcepub fn unexplained(entries: Vec<MemoryEntry>) -> Result<Self, DomainError>
pub fn unexplained(entries: Vec<MemoryEntry>) -> Result<Self, DomainError>
Entries with nothing yet connecting them.
Honest for a first entry, which has nothing earlier to explain it. Reached for habitually, it is how a memory ends up being a list.