From d2ebbf76482393a3c9541ae82fb5961672ad0165 Mon Sep 17 00:00:00 2001 From: orbwalk Date: Wed, 23 Feb 2022 10:56:35 +0100 Subject: [PATCH] Wrap stubs mutex in arc --- src/mock_store.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/mock_store.rs b/src/mock_store.rs index fd5a6a5..d05e6ec 100644 --- a/src/mock_store.rs +++ b/src/mock_store.rs @@ -44,16 +44,16 @@ impl MaybeFaux { } } -#[derive(Debug, Default)] +#[derive(Clone, Debug, Default)] #[doc(hidden)] pub struct MockStore { - stubs: Mutex>>>>>, + stubs: Arc>>>>>>, } impl MockStore { fn new() -> Self { MockStore { - stubs: Mutex::new(HashMap::new()), + stubs: Arc::new(Mutex::new(HashMap::new())), } } @@ -115,12 +115,3 @@ impl MockStore { Err(errors.join("\n\n")) } } - -impl Clone for MockStore { - fn clone(&self) -> Self { - let stubs = self.stubs.lock().unwrap(); - Self { - stubs: Mutex::new(stubs.clone()), - } - } -}