Trait Transport

Source
pub trait Transport {
    type Future: Future<Item = Vec<u8>, Error = Self::Error> + Send + 'static;
    type Error: Error + Send + 'static;

    // Required methods
    fn get_next_id(&mut self) -> u64;
    fn send(&self, json_data: Vec<u8>) -> Self::Future;
}
Expand description

Trait for types acting as a transport layer for the JSON-RPC 2.0 clients generated by the jsonrpc_client macro.

Required Associated Types§

Source

type Future: Future<Item = Vec<u8>, Error = Self::Error> + Send + 'static

The future type this transport returns on send operations.

Source

type Error: Error + Send + 'static

The type of error that this transport emits if it fails.

Required Methods§

Source

fn get_next_id(&mut self) -> u64

Returns an id that has not yet been used on this transport. Used by the RPC clients to fill in the “id” field of a request.

Source

fn send(&self, json_data: Vec<u8>) -> Self::Future

Sends the given data over the transport and returns a future that will complete with the response to the request, or the transport specific error if something went wrong.

Implementors§