Trait Middleware

Source
pub trait Middleware<Context: Send + 'static>:
    Clone
    + Send
    + Sync
    + 'static {
    type Metadata: DeserializeOwned + Send + 'static;

    // Provided methods
    fn process_http_request(
        &mut self,
        context: &Context,
        request: &mut Request,
    ) -> impl Future<Output = Result<(), Response>> + Send { ... }
    fn process_rpc_request(
        &mut self,
        context: &Context,
        metadata: Self::Metadata,
        request: &mut RpcRequest,
    ) -> impl Future<Output = Result<(), RpcResponse>> + Send { ... }
    fn process_rpc_response(
        &mut self,
        context: &Context,
        response: &mut RpcResponse,
    ) -> impl Future<Output = ()> + Send { ... }
    fn process_http_response(
        &mut self,
        context: &Context,
        response: &mut Response,
    ) -> impl Future<Output = ()> + Send { ... }
}

Required Associated Types§

Provided Methods§

Source

fn process_http_request( &mut self, context: &Context, request: &mut Request, ) -> impl Future<Output = Result<(), Response>> + Send

Source

fn process_rpc_request( &mut self, context: &Context, metadata: Self::Metadata, request: &mut RpcRequest, ) -> impl Future<Output = Result<(), RpcResponse>> + Send

Source

fn process_rpc_response( &mut self, context: &Context, response: &mut RpcResponse, ) -> impl Future<Output = ()> + Send

Source

fn process_http_response( &mut self, context: &Context, response: &mut Response, ) -> impl Future<Output = ()> + Send

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§