[][src]Struct libp2p::swarm::protocols_handler::SubstreamProtocol

pub struct SubstreamProtocol<TUpgrade> { /* 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].

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]

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]

impl<TUpgrade> PartialEq<SubstreamProtocol<TUpgrade>> for SubstreamProtocol<TUpgrade> where
    TUpgrade: PartialEq<TUpgrade>, 
[src]

impl<TUpgrade> Copy for SubstreamProtocol<TUpgrade> where
    TUpgrade: Copy
[src]

impl<TUpgrade> Debug for SubstreamProtocol<TUpgrade> where
    TUpgrade: Debug
[src]

impl<TUpgrade> Clone for SubstreamProtocol<TUpgrade> where
    TUpgrade: Clone
[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]

Auto Trait Implementations

impl<TUpgrade> Sync for SubstreamProtocol<TUpgrade> where
    TUpgrade: Sync

impl<TUpgrade> Send for SubstreamProtocol<TUpgrade> where
    TUpgrade: Send

impl<TUpgrade> Unpin for SubstreamProtocol<TUpgrade> where
    TUpgrade: Unpin

impl<TUpgrade> RefUnwindSafe for SubstreamProtocol<TUpgrade> where
    TUpgrade: RefUnwindSafe

impl<TUpgrade> UnwindSafe for SubstreamProtocol<TUpgrade> where
    TUpgrade: UnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T

impl<T> Erased for T