diff options
author | Vika <vika@fireburn.ru> | 2023-06-15 17:02:39 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2023-06-15 17:02:39 +0300 |
commit | eca7687439c2b6f804603de75501b6737a82e5a2 (patch) | |
tree | a4715e0b8d3d63ee8b77830670c473b83a70031e /kittybox-rs/src/database/memory.rs | |
parent | 59f3e2d43d30642e4242039ce3ab934961e69602 (diff) | |
download | kittybox-eca7687439c2b6f804603de75501b6737a82e5a2.tar.zst |
Database: use newtypes to represent settings
This allows much for a cleaner and idiomatic settings interface.
Diffstat (limited to 'kittybox-rs/src/database/memory.rs')
-rw-r--r-- | kittybox-rs/src/database/memory.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kittybox-rs/src/database/memory.rs b/kittybox-rs/src/database/memory.rs index c8cc125..2fb55e5 100644 --- a/kittybox-rs/src/database/memory.rs +++ b/kittybox-rs/src/database/memory.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; use std::sync::Arc; use tokio::sync::RwLock; -use crate::database::{ErrorKind, MicropubChannel, Result, Settings, Storage, StorageError}; +use crate::database::{ErrorKind, MicropubChannel, Result, settings, Storage, StorageError}; #[derive(Clone, Debug)] pub struct MemoryStorage { @@ -244,14 +244,15 @@ impl Storage for MemoryStorage { } #[allow(unused_variables)] - async fn get_setting(&self, setting: Settings, user: &'_ str) -> Result<String> { + async fn get_setting<S: settings::Setting<'a>, 'a>(&'_ self, user: &'_ str) -> Result<S> { todo!() } #[allow(unused_variables)] - async fn set_setting(&self, setting: Settings, user: &'_ str, value: &'_ str) -> Result<()> { + async fn set_setting<S: settings::Setting<'a>, 'a>(&self, user: &'_ str, value: S::Data) -> Result<()> { todo!() } + } impl Default for MemoryStorage { |