use axum::{async_trait, extract::FromRequestParts}; use http::request::Parts; use crate::{context::Context, model::response::ResErr}; #[async_trait] impl FromRequestParts for Context where S: Send + Sync, { type Rejection = ResErr; async fn from_request_parts(parts: &mut Parts, _: &S) -> Result { let context: &Context = parts.extensions.get().unwrap(); Ok(context.clone()) } }