test: boost coverage to 76% and optimize Store inspection

This commit is contained in:
Riz Ashraf committed 2026-09-18 09:49:19 +01:00
1 parent 81aac7245b
commit 26cf6cee80
3 files changed
+340 -1

No files matched your search

+8
View File
@@ -45,6 +45,14 @@ impl<T: DeserializeOwned + Default + Serialize + Clone + Send + 'static> Store<T
lock.clone()
}
pub fn inspect<F, R>(&self, f: F) -> R
where
F: FnOnce(&T) -> R,
{
let lock = self.cache.read().unwrap();
f(&lock)
}
pub fn modify<F: FnOnce(&mut T)>(&self, f: F) {
let mut lock = self.cache.write().unwrap();
f(&mut lock);