use crate::http::{MsgBufferString, Request, Response, StatusCode};
use core::ops::ControlFlow;
pub trait Middleware<D, ER>
where
ER: From<crate::Error>,
{
type Aux;
fn aux(&self) -> Self::Aux;
fn req(
&self,
data: &mut D,
mw_aux: &mut Self::Aux,
req: &mut Request<MsgBufferString>,
) -> impl Future<Output = Result<ControlFlow<StatusCode, ()>, ER>>;
fn res(
&self,
data: &mut D,
mw_aux: &mut Self::Aux,
res: Response<&mut MsgBufferString>,
) -> impl Future<Output = Result<ControlFlow<StatusCode, ()>, ER>>;
}