[][src]Trait tarpc::rpc::client::Client

pub trait Client<'a, Req> {
    type Response;
    type Future: Future<Output = Result<Self::Response>> + 'a;
    fn call(&'a mut self, ctx: Context, request: Req) -> Self::Future;

    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
, { ... } }

Sends multiplexed requests to, and receives responses from, a server.

Associated Types

type Response

The response type.

type Future: Future<Output = Result<Self::Response>> + 'a

The future response.

Loading content...

Required methods

fn call(&'a mut self, ctx: Context, request: Req) -> Self::Future

Initiates a request, sending it to the dispatch task.

Returns a Future that resolves to this client and the future response once the request is successfully enqueued.

Loading content...

Provided methods

fn map_response<F, R>(self, f: F) -> MapResponse<Self, F> where
    F: FnMut(Self::Response) -> R,
    Self: Sized

Returns a Client that applies a post-processing function to the returned response.

fn with_request<F, Req2>(self, f: F) -> WithRequest<Self, F> where
    F: FnMut(Req2) -> Req,
    Self: Sized

Returns a Client that applies a pre-processing function to the request.

Loading content...

Implementors

impl<'a, C, F, Req, Req2, Resp> Client<'a, Req2> for WithRequest<C, F> where
    C: Client<'a, Req, Response = Resp>,
    F: FnMut(Req2) -> Req, 
[src]

type Response = Resp

type Future = <C as Client<'a, Req>>::Future

impl<'a, C, F, Req, Resp, Resp2> Client<'a, Req> for MapResponse<C, F> where
    C: Client<'a, Req, Response = Resp>,
    F: FnMut(Resp) -> Resp2 + 'a, 
[src]

type Response = Resp2

type Future = MapOk<<C as Client<'a, Req>>::Future, &'a mut F>

impl<'a, Req, Resp> Client<'a, Req> for Channel<Req, Resp> where
    Req: 'a,
    Resp: 'a, 
[src]

type Response = Resp

type Future = Call<'a, Req, Resp>

Loading content...