[][src]Trait kayrx::jrpc::transport::TransportClient

pub trait TransportClient {
    type Error: Display;
    fn send_request<'a>(
        &'a mut self,
        request: Request
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>;
fn next_response<'a>(
        &'a mut self
    ) -> Pin<Box<dyn Future<Output = Result<Response, Self::Error>> + Send + 'a>>; }

Objects that can act as clients.

Note: Implementations of this trait are allowed (and encouraged, for example for HTTP 1.x) to open multiple simultaneous connections to the same server. However, since this trait doesn't expose the concept of a connection, and since implementations aren't expected to associated requests with responses, we have no way to enforce that the response to a request arrived on the same connection as the one where the request has been sent. In practice, though, this shouldn't be a problem.

Associated Types

type Error: Display

Error that can happen during a request.

Loading content...

Required methods

fn send_request<'a>(
    &'a mut self,
    request: Request
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>

Sends out out a request. Returns a Future that finishes when the request has been successfully sent.

fn next_response<'a>(
    &'a mut self
) -> Pin<Box<dyn Future<Output = Result<Response, Self::Error>> + Send + 'a>>

Returns a Future resolving when the server sent us something back.

Loading content...

Implementors

impl TransportClient for LocalTransportClient[src]

type Error = LocalTransportClientErr

Loading content...