From a3965eac2d1c6e51ba1a52f37683c8536447daf8 Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Sat, 25 Sep 2021 15:43:20 +0200 Subject: [PATCH] Also debug the model besides the storage --- libraries/persistent_store/fuzz/src/store.rs | 1 + libraries/persistent_store/src/driver.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/libraries/persistent_store/fuzz/src/store.rs b/libraries/persistent_store/fuzz/src/store.rs index b10c495..9e83587 100644 --- a/libraries/persistent_store/fuzz/src/store.rs +++ b/libraries/persistent_store/fuzz/src/store.rs @@ -53,6 +53,7 @@ pub fn fuzz(mut data: &[u8], debug: bool, stats: Option<&mut Stats>) { driver.check().unwrap(); } if fuzzer.debug { + println!("{:?}", driver.model().content()); println!("----------------------------------------------------------------------"); } } diff --git a/libraries/persistent_store/src/driver.rs b/libraries/persistent_store/src/driver.rs index 5889651..3f02ab5 100644 --- a/libraries/persistent_store/src/driver.rs +++ b/libraries/persistent_store/src/driver.rs @@ -200,6 +200,14 @@ impl StoreDriver { } } + /// Provides read-only access to the model. + pub fn model(&self) -> &StoreModel { + match self { + StoreDriver::On(x) => x.model(), + StoreDriver::Off(x) => x.model(), + } + } + /// Extracts the power-on version of the driver. pub fn on(self) -> Option { match self {