ic_web3_rs

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,
        options: CallOptions,
    ) -> Self::Out;

    // Provided methods
    fn execute(
        &self,
        method: &str,
        params: Vec<Value>,
        options: CallOptions,
    ) -> Self::Out { ... }
    fn set_max_response_bytes(&mut self, bytes: u64) { ... }
}
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, options: CallOptions) -> Self::Out

Execute prepared RPC call.

Provided Methods§

Source

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

Execute remote method with given parameters.

Source

fn set_max_response_bytes(&mut self, bytes: u64)

set the max response bytes, do nothing by default

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 ICHttp

Source§

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

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