made_core/ports/
memory_recollection.rs1use crate::value_objects::{MemoryEntry, MemoryRelation};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum MemoryRecollection {
6 Recalled {
7 entries: Vec<MemoryEntry>,
8 relations: Vec<MemoryRelation>,
9 },
10 Unsupported,
11}
12
13impl MemoryRecollection {
14 #[must_use]
15 pub fn of(entries: Vec<MemoryEntry>) -> Self {
16 Self::Recalled {
17 entries,
18 relations: Vec::new(),
19 }
20 }
21
22 #[must_use]
23 pub fn nothing() -> Self {
24 Self::of(Vec::new())
25 }
26
27 #[must_use]
28 pub fn entries(&self) -> &[MemoryEntry] {
29 match self {
30 Self::Recalled { entries, .. } => entries,
31 Self::Unsupported => &[],
32 }
33 }
34
35 #[must_use]
36 pub fn relations(&self) -> &[MemoryRelation] {
37 match self {
38 Self::Recalled { relations, .. } => relations,
39 Self::Unsupported => &[],
40 }
41 }
42
43 #[must_use]
44 pub const fn is_supported(&self) -> bool {
45 matches!(self, Self::Recalled { .. })
46 }
47}