pub trait Client<'a, Req> {
type Response;
type Future: Future<Output = Result<Self::Response>> + 'a;
// Required method
fn call(&'a mut self, ctx: Context, request: Req) -> Self::Future;
// Provided methods
fn map_response<F, R>(self, f: F) -> MapResponse<Self, F>
where F: FnMut(Self::Response) -> R,
Self: Sized { ... }
fn with_request<F, Req2>(self, f: F) -> WithRequest<Self, F>
where F: FnMut(Req2) -> Req,
Self: Sized { ... }
}
Expand description
Sends multiplexed requests to, and receives responses from, a server.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn map_response<F, R>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, R>(self, f: F) -> MapResponse<Self, F>
Returns a Client that applies a post-processing function to the returned response.
Sourcefn with_request<F, Req2>(self, f: F) -> WithRequest<Self, F>
fn with_request<F, Req2>(self, f: F) -> WithRequest<Self, F>
Returns a Client that applies a pre-processing function to the request.