Trait web3::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.

Implementors§

source§

impl Transport for Http

§

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

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,

§

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

source§

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

source§

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

§

type Out = <T as Transport>::Out