[][src]Enum libp2p_core::protocols_handler::ProtocolsHandlerEvent

pub enum ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom> {
    OutboundSubstreamRequest {
        upgrade: TConnectionUpgrade,
        info: TOutboundOpenInfo,
    },
    Shutdown,
    Custom(TCustom),
}

Event produced by a handler.

Variants

OutboundSubstreamRequest

Request a new outbound substream to be opened with the remote.

Fields of OutboundSubstreamRequest

upgrade: TConnectionUpgrade

The upgrade to apply on the substream.

info: TOutboundOpenInfo

User-defined information, passed back when the substream is open.

Shutdown

Perform a graceful shutdown of the connection to the remote.

Should be returned after shutdown() has been called.

Custom(TCustom)

Other event.

Methods

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom>
[src]

Event produced by a handler.

pub fn map_outbound_open_info<F, I>(
    self,
    map: F
) -> ProtocolsHandlerEvent<TConnectionUpgrade, I, TCustom> where
    F: FnOnce(TOutboundOpenInfo) -> I, 
[src]

If this is an OutboundSubstreamRequest, maps the info member from a TOutboundOpenInfo to something else.

pub fn map_protocol<F, I>(
    self,
    map: F
) -> ProtocolsHandlerEvent<I, TOutboundOpenInfo, TCustom> where
    F: FnOnce(TConnectionUpgrade) -> I, 
[src]

If this is an OutboundSubstreamRequest, maps the protocol (TConnectionUpgrade) to something else.

pub fn map_custom<F, I>(
    self,
    map: F
) -> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, I> where
    F: FnOnce(TCustom) -> I, 
[src]

If this is a Custom event, maps the content to something else.

Trait Implementations

impl<TConnectionUpgrade: Eq, TOutboundOpenInfo: Eq, TCustom: Eq> Eq for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom>
[src]

impl<TConnectionUpgrade: Copy, TOutboundOpenInfo: Copy, TCustom: Copy> Copy for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom>
[src]

impl<TConnectionUpgrade: PartialEq, TOutboundOpenInfo: PartialEq, TCustom: PartialEq> PartialEq<ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom>> for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom>
[src]

impl<TConnectionUpgrade: Clone, TOutboundOpenInfo: Clone, TCustom: Clone> Clone for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom>
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<TConnectionUpgrade: Debug, TOutboundOpenInfo: Debug, TCustom: Debug> Debug for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom>
[src]

Auto Trait Implementations

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom> Send for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom> where
    TConnectionUpgrade: Send,
    TCustom: Send,
    TOutboundOpenInfo: Send

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom> Sync for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom> where
    TConnectionUpgrade: Sync,
    TCustom: Sync,
    TOutboundOpenInfo: Sync

Blanket Implementations

impl<T> From for T
[src]

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

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T