Struct libp2p::swarm::SubstreamProtocol [−][src]
pub struct SubstreamProtocol<TUpgrade, TInfo> { /* fields omitted */ }
Configuration of inbound or outbound substream protocol(s)
for a ProtocolsHandler
.
The inbound substream protocol(s) are defined by ProtocolsHandler::listen_protocol
and the outbound substream protocol(s) by ProtocolsHandlerEvent::OutboundSubstreamRequest
.
Implementations
impl<TUpgrade, TInfo> SubstreamProtocol<TUpgrade, TInfo>
[src]
impl<TUpgrade, TInfo> SubstreamProtocol<TUpgrade, TInfo>
[src]pub fn new(upgrade: TUpgrade, info: TInfo) -> SubstreamProtocol<TUpgrade, TInfo>
[src]
Create a new SubstreamProtocol
from the given upgrade.
The default timeout for applying the given upgrade on a substream is 10 seconds.
pub fn with_upgrade_protocol(
self,
version: Version
) -> SubstreamProtocol<TUpgrade, TInfo>
[src]
self,
version: Version
) -> SubstreamProtocol<TUpgrade, TInfo>
Sets the multistream-select protocol (version) to use for negotiating protocols upgrades on outbound substreams.
pub fn map_upgrade<U, F>(self, f: F) -> SubstreamProtocol<U, TInfo> where
F: FnOnce(TUpgrade) -> U,
[src]
F: FnOnce(TUpgrade) -> U,
Maps a function over the protocol upgrade.
pub fn map_info<U, F>(self, f: F) -> SubstreamProtocol<TUpgrade, U> where
F: FnOnce(TInfo) -> U,
[src]
F: FnOnce(TInfo) -> U,
Maps a function over the protocol info.
pub fn with_timeout(
self,
timeout: Duration
) -> SubstreamProtocol<TUpgrade, TInfo>
[src]
self,
timeout: Duration
) -> SubstreamProtocol<TUpgrade, TInfo>
Sets a new timeout for the protocol upgrade.
pub fn upgrade(&self) -> &TUpgrade
[src]
Borrows the contained protocol upgrade.
pub fn info(&self) -> &TInfo
[src]
Borrows the contained protocol info.
pub fn timeout(&self) -> &Duration
[src]
Borrows the timeout for the protocol upgrade.
pub fn into_upgrade(self) -> (Version, TUpgrade, TInfo)
[src]
Converts the substream protocol configuration into the contained upgrade.
Trait Implementations
impl<TUpgrade, TInfo> Clone for SubstreamProtocol<TUpgrade, TInfo> where
TUpgrade: Clone,
TInfo: Clone,
[src]
impl<TUpgrade, TInfo> Clone for SubstreamProtocol<TUpgrade, TInfo> where
TUpgrade: Clone,
TInfo: Clone,
[src]pub fn clone(&self) -> SubstreamProtocol<TUpgrade, TInfo>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<TUpgrade, TInfo> Debug for SubstreamProtocol<TUpgrade, TInfo> where
TUpgrade: Debug,
TInfo: Debug,
[src]
impl<TUpgrade, TInfo> Debug for SubstreamProtocol<TUpgrade, TInfo> where
TUpgrade: Debug,
TInfo: Debug,
[src]impl<TUpgrade, TInfo> PartialEq<SubstreamProtocol<TUpgrade, TInfo>> for SubstreamProtocol<TUpgrade, TInfo> where
TUpgrade: PartialEq<TUpgrade>,
TInfo: PartialEq<TInfo>,
[src]
impl<TUpgrade, TInfo> PartialEq<SubstreamProtocol<TUpgrade, TInfo>> for SubstreamProtocol<TUpgrade, TInfo> where
TUpgrade: PartialEq<TUpgrade>,
TInfo: PartialEq<TInfo>,
[src]pub fn eq(&self, other: &SubstreamProtocol<TUpgrade, TInfo>) -> bool
[src]
pub fn ne(&self, other: &SubstreamProtocol<TUpgrade, TInfo>) -> bool
[src]
impl<TUpgrade, TInfo> Copy for SubstreamProtocol<TUpgrade, TInfo> where
TUpgrade: Copy,
TInfo: Copy,
[src]
TUpgrade: Copy,
TInfo: Copy,
impl<TUpgrade, TInfo> Eq for SubstreamProtocol<TUpgrade, TInfo> where
TUpgrade: Eq,
TInfo: Eq,
[src]
TUpgrade: Eq,
TInfo: Eq,
impl<TUpgrade, TInfo> StructuralEq for SubstreamProtocol<TUpgrade, TInfo>
[src]
impl<TUpgrade, TInfo> StructuralPartialEq for SubstreamProtocol<TUpgrade, TInfo>
[src]
Auto Trait Implementations
impl<TUpgrade, TInfo> RefUnwindSafe for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: RefUnwindSafe,
TUpgrade: RefUnwindSafe,
TInfo: RefUnwindSafe,
TUpgrade: RefUnwindSafe,
impl<TUpgrade, TInfo> Send for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: Send,
TUpgrade: Send,
TInfo: Send,
TUpgrade: Send,
impl<TUpgrade, TInfo> Sync for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: Sync,
TUpgrade: Sync,
TInfo: Sync,
TUpgrade: Sync,
impl<TUpgrade, TInfo> Unpin for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: Unpin,
TUpgrade: Unpin,
TInfo: Unpin,
TUpgrade: Unpin,
impl<TUpgrade, TInfo> UnwindSafe for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: UnwindSafe,
TUpgrade: UnwindSafe,
TInfo: UnwindSafe,
TUpgrade: UnwindSafe,