Trait RpcClient

Source
pub trait RpcClient: Send + Sync {
    // Required methods
    fn send_request<'life0, 'async_trait>(
        &'life0 self,
        req: Request,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn recv_response<'life0, 'async_trait>(
        &'life0 self,
        id: RequestId,
    ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn cancel<'life0, 'async_trait>(
        &'life0 self,
        cancel: Cancel,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn events(&self) -> Pin<Box<dyn Stream<Item = Event> + Send>>;
}
Expand description

RPC client interface layered on a Session, with request/response correlation and cancellation.

Required Methods§

Source

fn send_request<'life0, 'async_trait>( &'life0 self, req: Request, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a request; returns immediately after sending.

Source

fn recv_response<'life0, 'async_trait>( &'life0 self, id: RequestId, ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Await a response with the given id.

Source

fn cancel<'life0, 'async_trait>( &'life0 self, cancel: Cancel, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Cancel a request by id.

Source

fn events(&self) -> Pin<Box<dyn Stream<Item = Event> + Send>>

Receive server-initiated events.

Implementors§

Source§

impl<S: Session + 'static> RpcClient for DefaultRpcClient<S>