ProtocolsHandlerEvent

Enum ProtocolsHandlerEvent 

Source
pub enum ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> {
    OutboundSubstreamRequest {
        protocol: SubstreamProtocol<TConnectionUpgrade, TOutboundOpenInfo>,
    },
    Close(TErr),
    Custom(TCustom),
}
Expand description

Event produced by a handler.

Variants§

§

OutboundSubstreamRequest

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

Fields

§protocol: SubstreamProtocol<TConnectionUpgrade, TOutboundOpenInfo>

The protocol(s) to apply on the substream.

§

Close(TErr)

Close the connection for the given reason.

§

Custom(TCustom)

Other event.

Implementations§

Source§

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>

Event produced by a handler.

Source

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

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

Source

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

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

Source

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

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

Source

pub fn map_close<F, I>( self, map: F, ) -> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, I>
where F: FnOnce(TErr) -> I,

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

Trait Implementations§

Source§

impl<TConnectionUpgrade: Clone, TOutboundOpenInfo: Clone, TCustom: Clone, TErr: Clone> Clone for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>

Source§

fn clone( &self, ) -> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<TConnectionUpgrade: Debug, TOutboundOpenInfo: Debug, TCustom: Debug, TErr: Debug> Debug for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<TConnectionUpgrade: PartialEq, TOutboundOpenInfo: PartialEq, TCustom: PartialEq, TErr: PartialEq> PartialEq for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>

Source§

fn eq( &self, other: &ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>, ) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<TConnectionUpgrade: Copy, TOutboundOpenInfo: Copy, TCustom: Copy, TErr: Copy> Copy for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>

Source§

impl<TConnectionUpgrade: Eq, TOutboundOpenInfo: Eq, TCustom: Eq, TErr: Eq> Eq for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>

Source§

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> StructuralPartialEq for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>

Auto Trait Implementations§

§

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Freeze for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
where TErr: Freeze, TCustom: Freeze, TConnectionUpgrade: Freeze, TOutboundOpenInfo: Freeze,

§

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> RefUnwindSafe for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
where TErr: RefUnwindSafe, TCustom: RefUnwindSafe, TConnectionUpgrade: RefUnwindSafe, TOutboundOpenInfo: RefUnwindSafe,

§

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

§

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

§

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Unpin for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
where TErr: Unpin, TCustom: Unpin, TConnectionUpgrade: Unpin, TOutboundOpenInfo: Unpin,

§

impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> UnwindSafe for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
where TErr: UnwindSafe, TCustom: UnwindSafe, TConnectionUpgrade: UnwindSafe, TOutboundOpenInfo: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,