Trait jsonrpc_client_core::Transport [−][src]
pub trait Transport { type Future: Future<Item = Vec<u8>, Error = Self::Error> + Send + 'static; type Error: Error + Send + 'static; fn get_next_id(&mut self) -> u64; fn send(&self, json_data: Vec<u8>) -> Self::Future; }
Trait for types acting as a transport layer for the JSON-RPC 2.0 clients generated by the
jsonrpc_client
macro.
Associated Types
type Future: Future<Item = Vec<u8>, Error = Self::Error> + Send + 'static
The future type this transport returns on send operations.
type Error: Error + Send + 'static
The type of error that this transport emits if it fails.
Required Methods
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.
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.