[−][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
].
Methods
impl<TUpgrade> SubstreamProtocol<TUpgrade>
[src]
pub fn new(upgrade: TUpgrade) -> SubstreamProtocol<TUpgrade>
[src]
Create a new ListenProtocol
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> where
F: FnOnce(TUpgrade) -> U,
[src]
F: FnOnce(TUpgrade) -> U,
Maps a function over the protocol upgrade.
pub fn with_timeout(self, timeout: Duration) -> SubstreamProtocol<TUpgrade>
[src]
Sets a new timeout for the protocol upgrade.
pub fn upgrade(&self) -> &TUpgrade
[src]
Borrows the contained protocol upgrade.
pub fn timeout(&self) -> &Duration
[src]
Borrows the timeout for the protocol upgrade.
pub fn into_upgrade(self) -> TUpgrade
[src]
Converts the substream protocol configuration into the contained upgrade.
Trait Implementations
impl<TUpgrade> From<TUpgrade> for SubstreamProtocol<TUpgrade>
[src]
fn from(upgrade: TUpgrade) -> SubstreamProtocol<TUpgrade>
[src]
impl<TUpgrade> PartialEq<SubstreamProtocol<TUpgrade>> for SubstreamProtocol<TUpgrade> where
TUpgrade: PartialEq<TUpgrade>,
[src]
TUpgrade: PartialEq<TUpgrade>,
fn eq(&self, other: &SubstreamProtocol<TUpgrade>) -> bool
[src]
fn ne(&self, other: &SubstreamProtocol<TUpgrade>) -> bool
[src]
impl<TUpgrade> Copy for SubstreamProtocol<TUpgrade> where
TUpgrade: Copy,
[src]
TUpgrade: Copy,
impl<TUpgrade> Debug for SubstreamProtocol<TUpgrade> where
TUpgrade: Debug,
[src]
TUpgrade: Debug,
impl<TUpgrade> Clone for SubstreamProtocol<TUpgrade> where
TUpgrade: Clone,
[src]
TUpgrade: Clone,
fn clone(&self) -> SubstreamProtocol<TUpgrade>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<TUpgrade> Eq for SubstreamProtocol<TUpgrade> where
TUpgrade: Eq,
[src]
TUpgrade: Eq,
Auto Trait Implementations
impl<TUpgrade> Sync for SubstreamProtocol<TUpgrade> where
TUpgrade: Sync,
TUpgrade: Sync,
impl<TUpgrade> Send for SubstreamProtocol<TUpgrade> where
TUpgrade: Send,
TUpgrade: Send,
impl<TUpgrade> Unpin for SubstreamProtocol<TUpgrade> where
TUpgrade: Unpin,
TUpgrade: Unpin,
impl<TUpgrade> RefUnwindSafe for SubstreamProtocol<TUpgrade> where
TUpgrade: RefUnwindSafe,
TUpgrade: RefUnwindSafe,
impl<TUpgrade> UnwindSafe for SubstreamProtocol<TUpgrade> where
TUpgrade: UnwindSafe,
TUpgrade: UnwindSafe,
Blanket Implementations
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self