about summary refs log tree commit diff
path: root/src/database/memory.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/memory.rs')
-rw-r--r--src/database/memory.rs21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/database/memory.rs b/src/database/memory.rs
index 56caeec..be37fed 100644
--- a/src/database/memory.rs
+++ b/src/database/memory.rs
@@ -8,7 +8,7 @@ use tokio::sync::RwLock;
 
 use crate::database::{ErrorKind, MicropubChannel, Result, settings, Storage, StorageError};
 
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, Default)]
 pub struct MemoryStorage {
     pub mapping: Arc<RwLock<HashMap<String, serde_json::Value>>>,
     pub channels: Arc<RwLock<HashMap<url::Url, Vec<String>>>>,
@@ -16,6 +16,10 @@ pub struct MemoryStorage {
 
 #[async_trait]
 impl Storage for MemoryStorage {
+    async fn new(_url: &url::Url) -> Result<Self> {
+        Ok(Self::default())
+    }
+
     async fn categories(&self, _url: &str) -> Result<Vec<String>> {
         unimplemented!()
     }
@@ -231,18 +235,3 @@ impl Storage for MemoryStorage {
     }
 
 }
-
-impl Default for MemoryStorage {
-    fn default() -> Self {
-        Self::new()
-    }
-}
-
-impl MemoryStorage {
-    pub fn new() -> Self {
-        Self {
-            mapping: Arc::new(RwLock::new(HashMap::new())),
-            channels: Arc::new(RwLock::new(HashMap::new())),
-        }
-    }
-}