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§
Trait Implementations§
Source§impl<A, B, ABatch, BBatch> BatchTransport for Either<A, B>
impl<A, B, ABatch, BBatch> BatchTransport for Either<A, B>
Source§impl<A, B, AStream, BStream> DuplexTransport for Either<A, B>
impl<A, B, AStream, BStream> DuplexTransport for Either<A, B>
Source§type NotificationStream = Pin<Box<dyn Stream<Item = Value> + Send>>
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>
fn subscribe(&self, id: SubscriptionId) -> Result<Self::NotificationStream>
Add a subscription to this transport
Source§fn unsubscribe(&self, id: SubscriptionId) -> Result
fn unsubscribe(&self, id: SubscriptionId) -> Result
Remove a subscription from this transport
Source§impl<A, B, AOut, BOut> Transport for Either<A, B>
impl<A, B, AOut, BOut> Transport for Either<A, B>
Source§type Out = Pin<Box<dyn Future<Output = Result<Value, Error>> + Send>>
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)
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
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)
fn set_max_response_bytes(&mut self, v: u64)
set the max response bytes, do nothing by default
Auto Trait Implementations§
impl<A, B> Freeze for Either<A, B>
impl<A, B> RefUnwindSafe for Either<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Either<A, B>
impl<A, B> Sync for Either<A, B>
impl<A, B> Unpin for Either<A, B>
impl<A, B> UnwindSafe for Either<A, B>where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more