[−][src]Struct libp2p_swarm::protocols_handler::SubstreamProtocol
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]
pub fn new(upgrade: TUpgrade, info: TInfo) -> Self
[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) -> Self
[src]
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) -> Self
[src]
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: Clone, TInfo: Clone> Clone for SubstreamProtocol<TUpgrade, TInfo>
[src]
fn clone(&self) -> SubstreamProtocol<TUpgrade, TInfo>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<TUpgrade: Copy, TInfo: Copy> Copy for SubstreamProtocol<TUpgrade, TInfo>
[src]
impl<TUpgrade: Debug, TInfo: Debug> Debug for SubstreamProtocol<TUpgrade, TInfo>
[src]
impl<TUpgrade: Eq, TInfo: Eq> Eq for SubstreamProtocol<TUpgrade, TInfo>
[src]
impl<TUpgrade: PartialEq, TInfo: PartialEq> PartialEq<SubstreamProtocol<TUpgrade, TInfo>> for SubstreamProtocol<TUpgrade, TInfo>
[src]
fn eq(&self, other: &SubstreamProtocol<TUpgrade, TInfo>) -> bool
[src]
fn ne(&self, other: &SubstreamProtocol<TUpgrade, TInfo>) -> bool
[src]
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,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,