Trait Transport

Source
pub trait Transport: Debug + Clone {
    type Out: Future<Output = Result<Value>>;

    // Required methods
    fn prepare(&self, method: &str, params: Vec<Value>) -> (RequestId, Call);
    fn send(&self, id: RequestId, request: Call) -> Self::Out;

    // Provided method
    fn execute(&self, method: &str, params: Vec<Value>) -> Self::Out { ... }
}
Expand description

Transport implementation

Required Associated Types§

Source

type Out: Future<Output = Result<Value>>

The type of future this transport returns when a call is made.

Required Methods§

Source

fn prepare(&self, method: &str, params: Vec<Value>) -> (RequestId, Call)

Prepare serializable RPC call for given method with parameters.

Source

fn send(&self, id: RequestId, request: Call) -> Self::Out

Execute prepared RPC call.

Provided Methods§

Source

fn execute(&self, method: &str, params: Vec<Value>) -> Self::Out

Execute remote method with given parameters.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Transport for Http

Source§

type Out = Pin<Box<dyn Future<Output = Result<Value, Error>> + Send>>

Source§

impl Transport for Ipc

Source§

impl Transport for WebSocket

Source§

impl<A, B, AOut, BOut> Transport for Either<A, B>
where A: Transport<Out = AOut>, B: Transport<Out = BOut>, AOut: Future<Output = Result<Value>> + 'static + Send, BOut: Future<Output = Result<Value>> + 'static + Send,

Source§

type Out = Pin<Box<dyn Future<Output = Result<Value, Error>> + Send>>

Source§

impl<T> Transport for Batch<T>
where T: BatchTransport,

Source§

impl<X, T> Transport for X
where T: Transport + ?Sized, X: Deref<Target = T> + Debug + Clone,

Source§

type Out = <T as Transport>::Out