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();