Struct libp2p_core::protocols_handler::MapOutEvent
source · pub struct MapOutEvent<TProtoHandler, TMap> { /* private fields */ }
Expand description
Wrapper around a protocol handler that turns the output event into something else.
Trait Implementations
sourceimpl<TProtoHandler, TMap, TNewOut> ProtocolsHandler for MapOutEvent<TProtoHandler, TMap>where
TProtoHandler: ProtocolsHandler,
TMap: FnMut(TProtoHandler::OutEvent) -> TNewOut,
impl<TProtoHandler, TMap, TNewOut> ProtocolsHandler for MapOutEvent<TProtoHandler, TMap>where
TProtoHandler: ProtocolsHandler,
TMap: FnMut(TProtoHandler::OutEvent) -> TNewOut,
type InEvent = <TProtoHandler as ProtocolsHandler>::InEvent
type InEvent = <TProtoHandler as ProtocolsHandler>::InEvent
Custom event that can be received from the outside.
type OutEvent = TNewOut
type OutEvent = TNewOut
Custom event that can be produced by the handler and that will be returned to the outside.
type Error = <TProtoHandler as ProtocolsHandler>::Error
type Error = <TProtoHandler as ProtocolsHandler>::Error
Error that can happen when polling.
type Substream = <TProtoHandler as ProtocolsHandler>::Substream
type Substream = <TProtoHandler as ProtocolsHandler>::Substream
The type of the substream that contains the raw data.
type InboundProtocol = <TProtoHandler as ProtocolsHandler>::InboundProtocol
type InboundProtocol = <TProtoHandler as ProtocolsHandler>::InboundProtocol
The upgrade for the protocol or protocols handled by this handler.
type OutboundProtocol = <TProtoHandler as ProtocolsHandler>::OutboundProtocol
type OutboundProtocol = <TProtoHandler as ProtocolsHandler>::OutboundProtocol
The upgrade for the protocol or protocols handled by this handler.
type OutboundOpenInfo = <TProtoHandler as ProtocolsHandler>::OutboundOpenInfo
type OutboundOpenInfo = <TProtoHandler as ProtocolsHandler>::OutboundOpenInfo
Information about a substream. Can be sent to the handler through a
NodeHandlerEndpoint
,
and will be passed back in inject_substream
or inject_outbound_closed
. Read moresourcefn listen_protocol(&self) -> Self::InboundProtocol
fn listen_protocol(&self) -> Self::InboundProtocol
Produces a
ConnectionUpgrade
for the protocol or protocols to accept when listening. Read moresourcefn inject_fully_negotiated_inbound(
&mut self,
protocol: <Self::InboundProtocol as InboundUpgrade<Self::Substream>>::Output
)
fn inject_fully_negotiated_inbound(
&mut self,
protocol: <Self::InboundProtocol as InboundUpgrade<Self::Substream>>::Output
)
Injects a fully-negotiated substream in the handler. Read more
fn inject_fully_negotiated_outbound(
&mut self,
protocol: <Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Output,
info: Self::OutboundOpenInfo
)
sourcefn inject_event(&mut self, event: Self::InEvent)
fn inject_event(&mut self, event: Self::InEvent)
Injects an event coming from the outside in the handler.
sourcefn inject_dial_upgrade_error(
&mut self,
info: Self::OutboundOpenInfo,
error: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>
)
fn inject_dial_upgrade_error(
&mut self,
info: Self::OutboundOpenInfo,
error: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>
)
Indicates to the handler that upgrading a substream to the given protocol has failed.
sourcefn inject_inbound_closed(&mut self)
fn inject_inbound_closed(&mut self)
Indicates to the handler that the inbound part of the muxer has been closed, and that
therefore no more inbound substreams will be produced. Read more
sourcefn shutdown(&mut self)
fn shutdown(&mut self)
Indicates to the node that it should shut down. After that, it is expected that
poll()
returns Ready(None)
as soon as possible. Read moresourcefn poll(
&mut self
) -> Poll<ProtocolsHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::OutEvent>, Self::Error>
fn poll(
&mut self
) -> Poll<ProtocolsHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::OutEvent>, Self::Error>
Should behave like
Stream::poll()
. Should close if no more event can be produced and the
node should be closed. Read moresourcefn map_in_event<TNewIn, TMap>(self, map: TMap) -> MapInEvent<Self, TNewIn, TMap>where
Self: Sized,
TMap: Fn(&TNewIn) -> Option<&Self::InEvent>,
fn map_in_event<TNewIn, TMap>(self, map: TMap) -> MapInEvent<Self, TNewIn, TMap>where
Self: Sized,
TMap: Fn(&TNewIn) -> Option<&Self::InEvent>,
Adds a closure that turns the input event into something else.
sourcefn map_out_event<TMap, TNewOut>(self, map: TMap) -> MapOutEvent<Self, TMap>where
Self: Sized,
TMap: FnMut(Self::OutEvent) -> TNewOut,
fn map_out_event<TMap, TNewOut>(self, map: TMap) -> MapOutEvent<Self, TMap>where
Self: Sized,
TMap: FnMut(Self::OutEvent) -> TNewOut,
Adds a closure that turns the output event into something else.
sourcefn select<TProto2>(self, other: TProto2) -> ProtocolsHandlerSelect<Self, TProto2>where
Self: Sized,
fn select<TProto2>(self, other: TProto2) -> ProtocolsHandlerSelect<Self, TProto2>where
Self: Sized,
Builds an implementation of
ProtocolsHandler
that handles both this protocol and the
other one together. Read moresourcefn into_node_handler_builder(self) -> NodeHandlerWrapperBuilder<Self>where
Self: Sized,
fn into_node_handler_builder(self) -> NodeHandlerWrapperBuilder<Self>where
Self: Sized,
Creates a builder that will allow creating a
NodeHandler
that handles this protocol
exclusively. Read moresourcefn into_node_handler(self) -> NodeHandlerWrapper<Self>where
Self: Sized,
fn into_node_handler(self) -> NodeHandlerWrapper<Self>where
Self: Sized,
Builds an implementation of
NodeHandler
that handles this protocol exclusively. Read moreAuto Trait Implementations
impl<TProtoHandler, TMap> RefUnwindSafe for MapOutEvent<TProtoHandler, TMap>where
TMap: RefUnwindSafe,
TProtoHandler: RefUnwindSafe,
impl<TProtoHandler, TMap> Send for MapOutEvent<TProtoHandler, TMap>where
TMap: Send,
TProtoHandler: Send,
impl<TProtoHandler, TMap> Sync for MapOutEvent<TProtoHandler, TMap>where
TMap: Sync,
TProtoHandler: Sync,
impl<TProtoHandler, TMap> Unpin for MapOutEvent<TProtoHandler, TMap>where
TMap: Unpin,
TProtoHandler: Unpin,
impl<TProtoHandler, TMap> UnwindSafe for MapOutEvent<TProtoHandler, TMap>where
TMap: UnwindSafe,
TProtoHandler: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more