ic_web3_rs::transports::either

Enum Either

Source
pub enum Either<A, B> {
    Left(A),
    Right(B),
}
Expand description

A wrapper over two possible transports.

This type can be used to write semi-generic code without the hassle of making all functions generic.

See the examples folder for an example how to use it.

Variants§

§

Left(A)

First possible transport.

§

Right(B)

Second possible transport.

Trait Implementations§

Source§

impl<A, B, ABatch, BBatch> BatchTransport for Either<A, B>
where A: BatchTransport<Batch = ABatch>, B: BatchTransport<Batch = BBatch>, A::Out: 'static + Send, B::Out: 'static + Send, ABatch: Future<Output = Result<Vec<Result<Value>>>> + 'static + Send, BBatch: Future<Output = Result<Vec<Result<Value>>>> + 'static + Send,

Source§

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

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

fn send_batch<T>(&self, requests: T) -> Self::Batch
where T: IntoIterator<Item = (RequestId, Call)>,

Sends a batch of prepared RPC calls.
Source§

impl<A: Clone, B: Clone> Clone for Either<A, B>

Source§

fn clone(&self) -> Either<A, B>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug, B: Debug> Debug for Either<A, B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A, B, AStream, BStream> DuplexTransport for Either<A, B>
where A: DuplexTransport<NotificationStream = AStream>, B: DuplexTransport<NotificationStream = BStream>, A::Out: 'static + Send, B::Out: 'static + Send, AStream: Stream<Item = Value> + 'static + Send, BStream: Stream<Item = Value> + 'static + Send,

Source§

type NotificationStream = Pin<Box<dyn Stream<Item = Value> + Send>>

The type of stream this transport returns
Source§

fn subscribe(&self, id: SubscriptionId) -> Result<Self::NotificationStream>

Add a subscription to this transport
Source§

fn unsubscribe(&self, id: SubscriptionId) -> Result

Remove a subscription from this transport
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>>

The type of future this transport returns when a call is made.
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.
Source§

fn set_max_response_bytes(&mut self, v: u64)

set the max response bytes, do nothing by default
Source§

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

Execute remote method with given parameters.

Auto Trait Implementations§

§

impl<A, B> Freeze for Either<A, B>
where A: Freeze, B: Freeze,

§

impl<A, B> RefUnwindSafe for Either<A, B>

§

impl<A, B> Send for Either<A, B>
where A: Send, B: Send,

§

impl<A, B> Sync for Either<A, B>
where A: Sync, B: Sync,

§

impl<A, B> Unpin for Either<A, B>
where A: Unpin, B: Unpin,

§

impl<A, B> UnwindSafe for Either<A, B>
where A: UnwindSafe, B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V