pub struct Selector<A, B>(/* private fields */);
Expand description
Select two upgrades into one. Supports all the protocols supported by either sub-upgrade.
The protocols supported by the first element have a higher priority.
Implementations§
Trait Implementations§
Source§impl<A, B> UpgradeInfo for Selector<A, B>where
A: UpgradeInfo,
B: UpgradeInfo,
impl<A, B> UpgradeInfo for Selector<A, B>where
A: UpgradeInfo,
B: UpgradeInfo,
Source§type Info = EitherName<<A as UpgradeInfo>::Info, <B as UpgradeInfo>::Info>
type Info = EitherName<<A as UpgradeInfo>::Info, <B as UpgradeInfo>::Info>
Opaque type representing a negotiable protocol.
Source§fn protocol_info(&self) -> Vec<Self::Info>
fn protocol_info(&self) -> Vec<Self::Info>
Returns the list of protocols that are supported. Used during the negotiation process.
Source§impl<A, B, C> Upgrader<C> for Selector<A, B>
impl<A, B, C> Upgrader<C> for Selector<A, B>
Source§type Output = EitherOutput<<A as Upgrader<C>>::Output, <B as Upgrader<C>>::Output>
type Output = EitherOutput<<A as Upgrader<C>>::Output, <B as Upgrader<C>>::Output>
Output after the upgrade has been successfully negotiated and the handshake performed.
Source§fn upgrade_inbound<'async_trait>(
self,
socket: C,
info: <Self as UpgradeInfo>::Info,
) -> Pin<Box<dyn Future<Output = Result<EitherOutput<A::Output, B::Output>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn upgrade_inbound<'async_trait>(
self,
socket: C,
info: <Self as UpgradeInfo>::Info,
) -> Pin<Box<dyn Future<Output = Result<EitherOutput<A::Output, B::Output>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
After we have determined that the remote supports one of the protocols we support, this
method is called to start the handshake. Read more
Source§fn upgrade_outbound<'async_trait>(
self,
socket: C,
info: <Self as UpgradeInfo>::Info,
) -> Pin<Box<dyn Future<Output = Result<EitherOutput<A::Output, B::Output>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn upgrade_outbound<'async_trait>(
self,
socket: C,
info: <Self as UpgradeInfo>::Info,
) -> Pin<Box<dyn Future<Output = Result<EitherOutput<A::Output, B::Output>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
After we have determined that the remote supports one of the protocols we support, this
method is called to start the handshake. Read more
impl<A: Copy, B: Copy> Copy for Selector<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for Selector<A, B>
impl<A, B> RefUnwindSafe for Selector<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Selector<A, B>
impl<A, B> Sync for Selector<A, B>
impl<A, B> Unpin for Selector<A, B>
impl<A, B> UnwindSafe for Selector<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