use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RecordedMemoryView {
pub about: String,
pub memory_id: String,
pub accepted_entries: usize,
pub accepted_relations: usize,
pub accepted_evidence: usize,
pub read_after_write_ready: bool,
pub warnings: Vec<String>,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn a_recorded_view_survives_the_wire() {
let view = RecordedMemoryView {
about: "project:checkout".to_string(),
memory_id: "memory:record:1".to_string(),
accepted_entries: 1,
accepted_relations: 1,
accepted_evidence: 2,
read_after_write_ready: true,
warnings: vec!["one coordinate had no occurred_at".to_string()],
};
let bytes = serde_json::to_vec(&view).expect("serializes");
assert_eq!(
serde_json::from_slice::<RecordedMemoryView>(&bytes).expect("deserializes"),
view
);
}
}