rustify::endpoint

Trait MiddleWare

source
pub trait MiddleWare: Sync + Send {
    // Required methods
    fn request<E: Endpoint>(
        &self,
        endpoint: &E,
        req: &mut Request<Vec<u8>>,
    ) -> Result<(), ClientError>;
    fn response<E: Endpoint>(
        &self,
        endpoint: &E,
        resp: &mut Response<Vec<u8>>,
    ) -> Result<(), ClientError>;
}
Expand description

Modifies an Endpoint request and/or response before final processing.

Types implementing this trait that do not desire to implement both methods should instead return OK(()) to bypass any processing of the Request or Response.

Required Methods§

source

fn request<E: Endpoint>( &self, endpoint: &E, req: &mut Request<Vec<u8>>, ) -> Result<(), ClientError>

Modifies a Request from an Endpoint before it’s executed.

source

fn response<E: Endpoint>( &self, endpoint: &E, resp: &mut Response<Vec<u8>>, ) -> Result<(), ClientError>

Modifies a Response from an Endpoint before being returned as an EndpointResult.

Object Safety§

This trait is not object safe.

Implementors§