lariv-rs 0.1.0

Compile-time plugin web application framework built on Axum, SeaORM, Maud, and HTMX
Documentation
//! Shared Axum state for OTP routes (DB connection).
use std::sync::Arc;

use sea_orm::DatabaseConnection;

use super::otp::MemoryCache;

/// Shared Axum state for the OTP plugin routes.
#[derive(Clone)]
pub struct OtpState {
    pub db: DatabaseConnection,
    pub cache: Arc<MemoryCache>,
}

impl OtpState {
    pub fn new(db: DatabaseConnection) -> Self {
        Self {
            db,
            cache: Arc::new(MemoryCache::new()),
        }
    }
}