Upgrader

Trait Upgrader 

Source
pub trait Upgrader<C>: UpgradeInfo + Clone {
    type Output: Send;

    // Required methods
    fn upgrade_inbound<'async_trait>(
        self,
        socket: C,
        info: <Self as UpgradeInfo>::Info,
    ) -> Pin<Box<dyn Future<Output = Result<Self::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<Self::Output, TransportError>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Common trait for upgrades that can be applied on a connection.

Required Associated Types§

Source

type Output: Send

Output after the upgrade has been successfully negotiated and the handshake performed.

Required Methods§

Source

fn upgrade_inbound<'async_trait>( self, socket: C, info: <Self as UpgradeInfo>::Info, ) -> Pin<Box<dyn Future<Output = Result<Self::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.

The info is the identifier of the protocol, as produced by protocol_info.

Source

fn upgrade_outbound<'async_trait>( self, socket: C, info: <Self as UpgradeInfo>::Info, ) -> Pin<Box<dyn Future<Output = Result<Self::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.

The info is the identifier of the protocol, as produced by protocol_info.

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<A, B, C> Upgrader<C> for Selector<A, B>
where A: Upgrader<C> + Send, B: Upgrader<C> + Send, C: Send + 'static,

Source§

type Output = EitherOutput<<A as Upgrader<C>>::Output, <B as Upgrader<C>>::Output>

Source§

impl<T: Send + 'static> Upgrader<T> for DummyUpgrader

Source§

type Output = DummyStream<T>