Trait RequestInspector
pub trait RequestInspector<StateIn, RequestIn>:
Send
+ Sync
+ 'static {
type Error: Send + Sync + 'static;
type RequestOut: Send + 'static;
type StateOut: Clone + Send + Sync + 'static;
// Required method
fn inspect_request(
&self,
ctx: Context<StateIn>,
req: RequestIn,
) -> impl Future<Output = Result<(Context<Self::StateOut>, Self::RequestOut), Self::Error>> + Send;
}
Expand description
A special kind of Service
which has access only to the Request,
but not to the Response.
Useful in case you want to explicitly restrict this acccess or because the Response would anyway not yet be produced at the point this inspector would be layered.
Required Associated Types§
Required Methods§
fn inspect_request(
&self,
ctx: Context<StateIn>,
req: RequestIn,
) -> impl Future<Output = Result<(Context<Self::StateOut>, Self::RequestOut), Self::Error>> + Send
fn inspect_request( &self, ctx: Context<StateIn>, req: RequestIn, ) -> impl Future<Output = Result<(Context<Self::StateOut>, Self::RequestOut), Self::Error>> + Send
Inspect the request, modify it if needed or desired, and return it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.