trait bound

This commit is contained in:
deneb 2024-02-10 12:11:36 +01:00
parent d4639c3152
commit 3c5bff0237

View file

@ -5,7 +5,7 @@ use std::sync::Arc;
use tokio::sync::Mutex;
use tracing::instrument;
use crate::db::SqliteDatabase;
use crate::db::{Database, SqliteDatabase};
#[derive(Debug, Clone, Deserialize)]
pub struct Password(pub SecretString);
@ -13,11 +13,11 @@ pub struct Password(pub SecretString);
pub struct UserToken(pub SecretString);
#[derive(Debug)]
pub struct Authenticator {
db: Arc<Mutex<SqliteDatabase>>,
pub struct Authenticator<DB: Database> {
db: Arc<Mutex<DB>>,
}
impl Authenticator {
impl Authenticator<SqliteDatabase> {
pub fn new(db: Arc<Mutex<SqliteDatabase>>) -> Self {
Self { db }
}