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]
#[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,
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]
&self
) -> Box<dyn ProtocolHandler<Info = ProtocolId> + 'static + Sync + Send, Global>
This is to provide a clone method for the trait object.
Implementors
impl ProtocolHandler for Handler
[src]
pub fn handle<'life0, 'async_trait>(
&'life0 mut self,
stream: Substream,
_info: <Handler as UpgradeInfo>::Info
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + 'static, Global>>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
Handler: 'async_trait,
[src]
&'life0 mut self,
stream: Substream,
_info: <Handler as UpgradeInfo>::Info
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + 'static, Global>>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
Handler: 'async_trait,
pub fn box_clone(
&self
) -> Box<dyn ProtocolHandler<Info = ProtocolId> + 'static + Sync + Send, Global>
[src]
&self
) -> Box<dyn ProtocolHandler<Info = ProtocolId> + 'static + Sync + Send, Global>
impl ProtocolHandler for KadProtocolHandler
[src]
pub fn handle<'life0, 'async_trait>(
&'life0 mut self,
stream: Substream,
_info: <KadProtocolHandler as UpgradeInfo>::Info
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + 'static, Global>>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
KadProtocolHandler: 'async_trait,
[src]
&'life0 mut self,
stream: Substream,
_info: <KadProtocolHandler as UpgradeInfo>::Info
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + 'static, Global>>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
KadProtocolHandler: 'async_trait,
pub fn box_clone(
&self
) -> Box<dyn ProtocolHandler<Info = ProtocolId> + 'static + Sync + Send, Global>
[src]
&self
) -> Box<dyn ProtocolHandler<Info = ProtocolId> + 'static + Sync + Send, Global>