use crate::{game::AnkiDB, storage::Storage};
#[derive(Default)]
pub struct DummyStorage(AnkiDB);
impl Storage for DummyStorage {
type ErrorType = ();
fn read_db(&self) -> Result<AnkiDB, Self::ErrorType> {
Ok(self.0.clone())
}
fn write_db(&mut self, db: &AnkiDB) -> Result<(), Self::ErrorType> {
self.0 = db.clone();
Ok(())
}
}
pub trait DynStorage<E: std::fmt::Debug> {
fn read_custom(&mut self, s: &dyn Storage<ErrorType = E>) -> Result<(), E>;
fn write_custom(&mut self, s: &mut dyn Storage<ErrorType = E>) -> Result<(), E>;
fn exit_custom(&mut self, s: &mut dyn Storage<ErrorType = E>);
}