Struct tet_libp2p_swarm::protocols_handler::SubstreamProtocol[][src]

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


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 tet-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, 

Maps a function over the protocol upgrade.

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) -> 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]

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]

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

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

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

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

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

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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>,