Struct SubstreamProtocol
pub struct SubstreamProtocol<TUpgrade, TInfo> { /* private fields */ }
Expand description
Configuration of inbound or outbound substream protocol(s)
for a ConnectionHandler
.
The inbound substream protocol(s) are defined by ConnectionHandler::listen_protocol
and the outbound substream protocol(s) by ConnectionHandlerEvent::OutboundSubstreamRequest
.
Implementations§
§impl<TUpgrade, TInfo> SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> SubstreamProtocol<TUpgrade, TInfo>
pub fn new(upgrade: TUpgrade, info: TInfo) -> SubstreamProtocol<TUpgrade, TInfo>
pub fn new(upgrade: TUpgrade, info: TInfo) -> SubstreamProtocol<TUpgrade, TInfo>
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.
pub fn with_timeout(
self,
timeout: Duration,
) -> SubstreamProtocol<TUpgrade, TInfo>
pub fn with_timeout( self, timeout: Duration, ) -> SubstreamProtocol<TUpgrade, TInfo>
Sets a new timeout for the protocol upgrade.
pub fn into_upgrade(self) -> (TUpgrade, TInfo)
pub fn into_upgrade(self) -> (TUpgrade, TInfo)
Converts the substream protocol configuration into the contained upgrade.
Trait Implementations§
§impl<TUpgrade, TInfo> Clone for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> Clone for SubstreamProtocol<TUpgrade, TInfo>
§fn clone(&self) -> SubstreamProtocol<TUpgrade, TInfo>
fn clone(&self) -> SubstreamProtocol<TUpgrade, TInfo>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl<TUpgrade, TInfo> Debug for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> Debug for SubstreamProtocol<TUpgrade, TInfo>
§impl<TUpgrade, TInfo> PartialEq for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> PartialEq for SubstreamProtocol<TUpgrade, TInfo>
§fn eq(&self, other: &SubstreamProtocol<TUpgrade, TInfo>) -> bool
fn eq(&self, other: &SubstreamProtocol<TUpgrade, TInfo>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl<TUpgrade, TInfo> Copy for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> Eq for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> StructuralPartialEq for SubstreamProtocol<TUpgrade, TInfo>
Auto Trait Implementations§
impl<TUpgrade, TInfo> Freeze for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> RefUnwindSafe for SubstreamProtocol<TUpgrade, TInfo>where
TUpgrade: RefUnwindSafe,
TInfo: RefUnwindSafe,
impl<TUpgrade, TInfo> Send for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> Sync for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> Unpin for SubstreamProtocol<TUpgrade, TInfo>
impl<TUpgrade, TInfo> UnwindSafe for SubstreamProtocol<TUpgrade, TInfo>where
TUpgrade: UnwindSafe,
TInfo: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more