use axum::{extract::{FromRef, FromRequestParts}, async_trait, http::request::Parts}; use sqlx::{postgres::Postgres, Pool}; #[derive(Clone, FromRef)] pub struct AppState { pub pool: Pool, pub hbs: handlebars::Handlebars<'static>, } #[async_trait] impl FromRequestParts for AppState where Self: FromRef, S: Send + Sync, { type Rejection = &'static str; async fn from_request_parts(_parts: &mut Parts, state: &S) -> Result { Ok(Self::from_ref(state)) } }