pub mod any;
pub mod cache_control;
pub mod catch_panic;
pub mod compression;
pub mod cors;
pub mod default;
pub mod etag;
pub mod request_id;
pub mod sensitive_headers;
pub mod size_limit;
pub mod timeout;
pub mod tracing;
use crate::app::context::AppContext;
use axum::Router;
use axum_core::extract::FromRef;
#[cfg_attr(test, mockall::automock(type Error = crate::error::Error;))]
pub trait Middleware<S>: Send
where
S: 'static + Send + Sync + Clone,
AppContext: FromRef<S>,
{
type Error: Send + Sync + std::error::Error;
fn name(&self) -> String;
fn enabled(&self, state: &S) -> bool;
fn priority(&self, state: &S) -> i32;
fn install(&self, state: &S, router: Router) -> Result<Router, Self::Error>;
}