ceres_support/traits/cache.rs
1//! Cache trait
2use crate::{traits::Storage, types::State};
3use ceres_std::Rc;
4use core::cell::RefCell;
5
6/// Cache traits
7pub trait Cache<Memory: 'static + Clone>: Storage {
8 /// Get frame
9 fn frame(&self) -> &Vec<Rc<RefCell<State<Memory>>>>;
10
11 /// Get frame mut
12 fn frame_mut(&mut self) -> &mut Vec<Rc<RefCell<State<Memory>>>>;
13
14 /// Memory
15 fn memory(&self) -> Option<Memory>;
16
17 /// (lifecycle) Flush data
18 fn flush(&mut self) -> Option<()> {
19 Some(())
20 }
21}