[][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 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> where
    F: FnOnce(TUpgrade) -> U, 
[src]

Maps a function over the protocol upgrade.

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 timeout(&self) -> &Duration[src]

Borrows the timeout for the protocol upgrade.

pub fn into_upgrade(self) -> (Version, TUpgrade)[src]

Converts the substream protocol configuration into the contained upgrade.

Trait Implementations

impl<TUpgrade: Clone> Clone for SubstreamProtocol<TUpgrade>[src]

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

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

impl<TUpgrade: Eq> Eq for SubstreamProtocol<TUpgrade>[src]

impl<TUpgrade> From<TUpgrade> for SubstreamProtocol<TUpgrade>[src]

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

impl<TUpgrade> StructuralEq for SubstreamProtocol<TUpgrade>[src]

impl<TUpgrade> StructuralPartialEq for SubstreamProtocol<TUpgrade>[src]

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,