Struct libp2p_swarm::protocols_handler::SubstreamProtocol
source · [−]pub struct SubstreamProtocol<TUpgrade, TInfo> { /* private fields */ }
Expand description
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
Create a new SubstreamProtocol
from the given upgrade.
The default timeout for applying the given upgrade on a substream is 10 seconds.
pub fn map_upgrade<U, F>(self, f: F) -> SubstreamProtocol<U, TInfo> where
F: FnOnce(TUpgrade) -> U,
pub fn map_upgrade<U, F>(self, f: F) -> SubstreamProtocol<U, TInfo> where
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,
pub fn map_info<U, F>(self, f: F) -> SubstreamProtocol<TUpgrade, U> where
F: FnOnce(TInfo) -> U,
Maps a function over the protocol info.
Sets a new timeout for the protocol upgrade.
Converts the substream protocol configuration into the contained upgrade.
Trait Implementations
impl<TUpgrade: PartialEq, TInfo: PartialEq> PartialEq<SubstreamProtocol<TUpgrade, TInfo>> for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade: PartialEq, TInfo: PartialEq> PartialEq<SubstreamProtocol<TUpgrade, TInfo>> for SubstreamProtocol<TUpgrade, TInfo>
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<TUpgrade, TInfo> RefUnwindSafe for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: RefUnwindSafe,
TUpgrade: RefUnwindSafe,
impl<TUpgrade, TInfo> Send for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: Send,
TUpgrade: Send,
impl<TUpgrade, TInfo> Sync for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: Sync,
TUpgrade: Sync,
impl<TUpgrade, TInfo> Unpin for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: Unpin,
TUpgrade: Unpin,
impl<TUpgrade, TInfo> UnwindSafe for SubstreamProtocol<TUpgrade, TInfo> where
TInfo: UnwindSafe,
TUpgrade: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more