Struct libp2p_swarm::protocols_handler::NodeHandlerWrapper
source · [−]pub struct NodeHandlerWrapper<TProtoHandler> where
TProtoHandler: ProtocolsHandler, { /* private fields */ }
Expand description
Wraps around an implementation of ProtocolsHandler
, and implements NodeHandler
.
Trait Implementations
sourceimpl<TProtoHandler> ConnectionHandler for NodeHandlerWrapper<TProtoHandler> where
TProtoHandler: ProtocolsHandler,
impl<TProtoHandler> ConnectionHandler for NodeHandlerWrapper<TProtoHandler> where
TProtoHandler: ProtocolsHandler,
type InEvent = TProtoHandler::InEvent
type InEvent = TProtoHandler::InEvent
The inbound type of events used to notify the handler through the Network
. Read more
type OutEvent = TProtoHandler::OutEvent
type OutEvent = TProtoHandler::OutEvent
The outbound type of events that the handler emits to the Network
through ConnectionHandler::poll
. Read more
type Error = NodeHandlerWrapperError<TProtoHandler::Error>
type Error = NodeHandlerWrapperError<TProtoHandler::Error>
The type of errors that the handler can produce when polled by the Network
.
type Substream = Substream<StreamMuxerBox>
type Substream = Substream<StreamMuxerBox>
The type of the substream containing the data.
type OutboundOpenInfo = (u64, TProtoHandler::OutboundOpenInfo, Duration)
type OutboundOpenInfo = (u64, TProtoHandler::OutboundOpenInfo, Duration)
Information about a substream. Can be sent to the handler through a SubstreamEndpoint
,
and will be passed back in inject_substream
or inject_outbound_closed
. Read more
sourcefn inject_substream(
&mut self,
substream: Self::Substream,
endpoint: SubstreamEndpoint<Self::OutboundOpenInfo>
)
fn inject_substream(
&mut self,
substream: Self::Substream,
endpoint: SubstreamEndpoint<Self::OutboundOpenInfo>
)
Sends a new substream to the handler. Read more
sourcefn inject_event(&mut self, event: Self::InEvent)
fn inject_event(&mut self, event: Self::InEvent)
Notifies the handler of an event.
sourcefn inject_address_change(&mut self, new_address: &Multiaddr)
fn inject_address_change(&mut self, new_address: &Multiaddr)
Notifies the handler of a change in the address of the remote.
sourcefn poll(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<ConnectionHandlerEvent<Self::OutboundOpenInfo, Self::OutEvent>, Self::Error>>
fn poll(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<ConnectionHandlerEvent<Self::OutboundOpenInfo, Self::OutEvent>, Self::Error>>
Polls the handler for events. Read more
Auto Trait Implementations
impl<TProtoHandler> !RefUnwindSafe for NodeHandlerWrapper<TProtoHandler>
impl<TProtoHandler> Send for NodeHandlerWrapper<TProtoHandler>
impl<TProtoHandler> Sync for NodeHandlerWrapper<TProtoHandler> where
TProtoHandler: Sync,
<<TProtoHandler as ProtocolsHandler>::InboundProtocol as InboundUpgradeSend>::Future: Sync,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as OutboundUpgradeSend>::Future: Sync,
<TProtoHandler as ProtocolsHandler>::InboundOpenInfo: Sync,
<TProtoHandler as ProtocolsHandler>::InboundProtocol: Sync,
<<TProtoHandler as ProtocolsHandler>::InboundProtocol as UpgradeInfoSend>::Info: Sync,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as UpgradeInfoSend>::Info: Sync,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as UpgradeInfoSend>::InfoIter: Sync,
<TProtoHandler as ProtocolsHandler>::OutboundOpenInfo: Sync,
<TProtoHandler as ProtocolsHandler>::OutboundProtocol: Sync,
impl<TProtoHandler> Unpin for NodeHandlerWrapper<TProtoHandler> where
TProtoHandler: Unpin,
<TProtoHandler as ProtocolsHandler>::OutboundProtocol: Unpin,
impl<TProtoHandler> !UnwindSafe for NodeHandlerWrapper<TProtoHandler>
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> IntoConnectionHandler for T where
T: ConnectionHandler,
impl<T> IntoConnectionHandler for T where
T: ConnectionHandler,
type Handler = T
type Handler = T
The node handler.
sourcepub fn into_handler(self, &Connected) -> T
pub fn into_handler(self, &Connected) -> T
Builds the node handler. Read more