Trait libp2p_rs::swarm::protocol_handler::ProtocolHandler[][src]

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 + 'static, Global>>> + 'async_trait + Send, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
pub fn box_clone(
        &self
    ) -> Box<dyn ProtocolHandler<Info = ProtocolId> + 'static + Sync + Send, Global>; }

Common trait for handling protocol inbound sub-stream.

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 + 'static, Global>>> + 'async_trait + Send, Global>> 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 runtime.

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

pub fn box_clone(
    &self
) -> Box<dyn ProtocolHandler<Info = ProtocolId> + 'static + Sync + Send, Global>
[src]

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

Loading content...

Implementors

impl ProtocolHandler for Handler[src]

impl ProtocolHandler for KadProtocolHandler[src]

Loading content...