From 9e0ba8b65df7def3a8cafdf36b25a11fa3037281 Mon Sep 17 00:00:00 2001 From: TotallyNot <44345987+TotallyNot@users.noreply.github.com> Date: Thu, 26 Jan 2023 20:14:04 +0100 Subject: [PATCH] removed default implementation of KeyDomain --- torn-key-pool/Cargo.toml | 2 +- torn-key-pool/src/lib.rs | 2 -- torn-key-pool/src/postgres.rs | 10 ++++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/torn-key-pool/Cargo.toml b/torn-key-pool/Cargo.toml index 8057755..bfc726e 100644 --- a/torn-key-pool/Cargo.toml +++ b/torn-key-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-key-pool" -version = "0.5.1" +version = "0.5.2" edition = "2021" authors = ["Pyrit [2111649]"] license = "MIT" diff --git a/torn-key-pool/src/lib.rs b/torn-key-pool/src/lib.rs index 8e7ed66..379ec72 100644 --- a/torn-key-pool/src/lib.rs +++ b/torn-key-pool/src/lib.rs @@ -39,8 +39,6 @@ pub trait KeyDomain: Clone + std::fmt::Debug + Send + Sync { } } -impl KeyDomain for T where T: Clone + std::fmt::Debug + Send + Sync {} - #[async_trait] pub trait KeyPoolStorage { type Key: ApiKey; diff --git a/torn-key-pool/src/postgres.rs b/torn-key-pool/src/postgres.rs index f92085d..4f7b09f 100644 --- a/torn-key-pool/src/postgres.rs +++ b/torn-key-pool/src/postgres.rs @@ -502,10 +502,20 @@ pub(crate) mod test { #[serde(tag = "type", rename_all = "snake_case")] pub(crate) enum Domain { All, + Guild { id: i64 }, User { id: i32 }, Faction { id: i32 }, } + impl KeyDomain for Domain { + fn fallback(&self) -> Option { + match self { + Self::Guild { id: _ } => Some(Self::All), + _ => None, + } + } + } + pub(crate) async fn setup() -> PgKeyPoolStorage { INIT.call_once(|| { dotenv::dotenv().ok();