removed default implementation of KeyDomain

This commit is contained in:
TotallyNot 2023-01-26 20:14:04 +01:00
parent 3e5a9e8e0b
commit 9e0ba8b65d
3 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "torn-key-pool"
version = "0.5.1"
version = "0.5.2"
edition = "2021"
authors = ["Pyrit [2111649]"]
license = "MIT"

View file

@ -39,8 +39,6 @@ pub trait KeyDomain: Clone + std::fmt::Debug + Send + Sync {
}
}
impl<T> KeyDomain for T where T: Clone + std::fmt::Debug + Send + Sync {}
#[async_trait]
pub trait KeyPoolStorage {
type Key: ApiKey;

View file

@ -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<Self> {
match self {
Self::Guild { id: _ } => Some(Self::All),
_ => None,
}
}
}
pub(crate) async fn setup() -> PgKeyPoolStorage<Domain> {
INIT.call_once(|| {
dotenv::dotenv().ok();