Trait ncomm_core::client_server::Client

source ·
pub trait Client {
    type Request;
    type Response;
    type Error;

    // Required methods
    fn send_request(
        &mut self,
        request: Self::Request,
    ) -> Result<(), Self::Error>;
    fn poll_for_responses(
        &mut self,
    ) -> Vec<Result<(Self::Request, Self::Response), Self::Error>>;
}
Expand description

A common abstraction for all NComm clients to allow for the creation of a common method of sending requests and receiving responses.

Required Associated Types§

source

type Request

The type of data used as a request by the client

source

type Response

The type of data used as a response from the server

source

type Error

The type of error from sending or receiving data from the server

Required Methods§

source

fn send_request(&mut self, request: Self::Request) -> Result<(), Self::Error>

Send a request to the server this client is associated with

source

fn poll_for_responses( &mut self, ) -> Vec<Result<(Self::Request, Self::Response), Self::Error>>

Check for a response from the server containing both the sent request and the response from the server

Implementors§