miniweb/src/state.rs

27 lines
627 B
Rust

use axum::extract::FromRef;
use rear::depot::state::{DepotState, SharedDepotRegistry};
use rear::service::templates;
#[derive(Clone)]
pub struct AppState {
pub templates: templates::Templates,
pub admin: SharedDepotRegistry,
}
impl FromRef<AppState> for templates::Templates {
fn from_ref(app_state: &AppState) -> templates::Templates {
app_state.templates.clone()
}
}
impl DepotState for AppState {
fn get_templates(&self) -> &templates::Templates {
&self.templates
}
fn get_registry(&self) -> SharedDepotRegistry {
self.admin.clone()
}
}