rama::http::dep::core::inspect

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§

type Error: Send + Sync + 'static

The type of error returned by the service.

type RequestOut: Send + 'static

type StateOut: Clone + Send + Sync + 'static

Required Methods§

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.

Implementors§

§

impl<S, StateIn, StateOut, RequestIn, RequestOut> RequestInspector<StateIn, RequestIn> for S
where S: Service<StateIn, RequestIn, Response = (Context<StateOut>, RequestOut)>, RequestIn: Send + 'static, RequestOut: Send + 'static, StateIn: Clone + Send + Sync + 'static, StateOut: Clone + Send + Sync + 'static,

§

type Error = <S as Service<StateIn, RequestIn>>::Error

§

type RequestOut = RequestOut

§

type StateOut = StateOut