Enum libp2p::swarm::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
Fields
protocol: SubstreamProtocol<TConnectionUpgrade, TOutboundOpenInfo>
The protocol(s) to apply on the substream.
Request a new outbound substream to be opened with the remote.
Close(TErr)
Close the connection for the given reason.
Custom(TCustom)
Other event.
Implementations
sourceimpl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
Event produced by a handler.
sourcepub fn map_outbound_open_info<F, I>(
self,
map: F
) -> ProtocolsHandlerEvent<TConnectionUpgrade, I, TCustom, TErr> where
F: FnOnce(TOutboundOpenInfo) -> I,
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.
sourcepub fn map_protocol<F, I>(
self,
map: F
) -> ProtocolsHandlerEvent<I, TOutboundOpenInfo, TCustom, TErr> where
F: FnOnce(TConnectionUpgrade) -> I,
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.
sourcepub fn map_custom<F, I>(
self,
map: F
) -> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, I, TErr> where
F: FnOnce(TCustom) -> I,
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.
sourcepub fn map_close<F, I>(
self,
map: F
) -> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, I> where
F: FnOnce(TErr) -> I,
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
sourceimpl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Clone for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Clone,
TOutboundOpenInfo: Clone,
TCustom: Clone,
TErr: Clone,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Clone for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Clone,
TOutboundOpenInfo: Clone,
TCustom: Clone,
TErr: Clone,
sourcepub fn clone(
&self
) -> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
pub fn clone(
&self
) -> ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Debug for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Debug,
TOutboundOpenInfo: Debug,
TCustom: Debug,
TErr: Debug,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Debug for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Debug,
TOutboundOpenInfo: Debug,
TCustom: Debug,
TErr: Debug,
sourceimpl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> PartialEq<ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>> for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: PartialEq<TConnectionUpgrade>,
TOutboundOpenInfo: PartialEq<TOutboundOpenInfo>,
TCustom: PartialEq<TCustom>,
TErr: PartialEq<TErr>,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> PartialEq<ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>> for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: PartialEq<TConnectionUpgrade>,
TOutboundOpenInfo: PartialEq<TOutboundOpenInfo>,
TCustom: PartialEq<TCustom>,
TErr: PartialEq<TErr>,
sourcepub fn eq(
&self,
other: &ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
) -> bool
pub fn eq(
&self,
other: &ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(
&self,
other: &ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
) -> bool
pub fn ne(
&self,
other: &ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
) -> bool
This method tests for !=
.
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Copy for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Copy,
TOutboundOpenInfo: Copy,
TCustom: Copy,
TErr: Copy,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Eq for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Eq,
TOutboundOpenInfo: Eq,
TCustom: Eq,
TErr: Eq,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> StructuralEq for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> StructuralPartialEq for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr>
Auto Trait Implementations
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> RefUnwindSafe for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: RefUnwindSafe,
TCustom: RefUnwindSafe,
TErr: RefUnwindSafe,
TOutboundOpenInfo: RefUnwindSafe,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Send for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Send,
TCustom: Send,
TErr: Send,
TOutboundOpenInfo: Send,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Sync for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Sync,
TCustom: Sync,
TErr: Sync,
TOutboundOpenInfo: Sync,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> Unpin for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: Unpin,
TCustom: Unpin,
TErr: Unpin,
TOutboundOpenInfo: Unpin,
impl<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> UnwindSafe for ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, TErr> where
TConnectionUpgrade: UnwindSafe,
TCustom: UnwindSafe,
TErr: UnwindSafe,
TOutboundOpenInfo: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more