[][src]Trait libp2prs_swarm::protocol_handler::ProtocolHandler

pub trait ProtocolHandler: UpgradeInfo + Notifiee {
#[must_use]    pub fn handle<'life0, 'async_trait>(
        &'life0 mut self,
        stream: Substream,
        info: Self::Info
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
pub fn box_clone(&self) -> IProtocolHandler; }

Common trait for upgrades that can be applied on inbound substreams, outbound substreams, or both. Possible upgrade on a connection or substream.

Required methods

#[must_use]pub fn handle<'life0, 'async_trait>(
    &'life0 mut self,
    stream: Substream,
    info: Self::Info
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

After we have determined that the remote supports one of the protocols we support, this method is called to start handling the inbound. Swarm will start invoking this method in a newly spawned task.

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

pub fn box_clone(&self) -> IProtocolHandler[src]

This is to provide a clone method for the trait object.

Loading content...

Implementors

impl ProtocolHandler for DummyProtocolHandler[src]

Loading content...