Struct libp2p_core::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> NodeHandler for NodeHandlerWrapper<TProtoHandler>where
TProtoHandler: ProtocolsHandler,
<TProtoHandler::OutboundProtocol as OutboundUpgrade<<TProtoHandler as ProtocolsHandler>::Substream>>::Error: Debug,
impl<TProtoHandler> NodeHandler for NodeHandlerWrapper<TProtoHandler>where
TProtoHandler: ProtocolsHandler,
<TProtoHandler::OutboundProtocol as OutboundUpgrade<<TProtoHandler as ProtocolsHandler>::Substream>>::Error: Debug,
type InEvent = <TProtoHandler as ProtocolsHandler>::InEvent
type InEvent = <TProtoHandler as ProtocolsHandler>::InEvent
Custom event that can be received from the outside.
type OutEvent = <TProtoHandler as ProtocolsHandler>::OutEvent
type OutEvent = <TProtoHandler as ProtocolsHandler>::OutEvent
Custom event that can be produced by the handler and that will be returned by the swarm.
type Error = <TProtoHandler as ProtocolsHandler>::Error
type Error = <TProtoHandler as ProtocolsHandler>::Error
Error that can happen during the processing of the node.
type Substream = <TProtoHandler as ProtocolsHandler>::Substream
type Substream = <TProtoHandler as ProtocolsHandler>::Substream
The type of the substream containing the data.
type OutboundOpenInfo = (u64, <TProtoHandler as ProtocolsHandler>::OutboundOpenInfo)
type OutboundOpenInfo = (u64, <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 inject_substream(
&mut self,
substream: Self::Substream,
endpoint: NodeHandlerEndpoint<Self::OutboundOpenInfo>
)
fn inject_substream(
&mut self,
substream: Self::Substream,
endpoint: NodeHandlerEndpoint<Self::OutboundOpenInfo>
)
Sends a new substream to the handler. Read more
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 substream will be produced. Read more
sourcefn inject_outbound_closed(&mut self, user_data: Self::OutboundOpenInfo)
fn inject_outbound_closed(&mut self, user_data: Self::OutboundOpenInfo)
Indicates to the handler that an outbound substream failed to open because the outbound
part of the muxer has been closed. Read more
sourcefn inject_event(&mut self, event: Self::InEvent)
fn inject_event(&mut self, event: Self::InEvent)
Injects an event coming from the outside into the handler.
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(NodeHandlerEvent::Shutdown)
as soon as possible. Read moresourcefn poll(
&mut self
) -> Poll<NodeHandlerEvent<Self::OutboundOpenInfo, Self::OutEvent>, Self::Error>
fn poll(
&mut self
) -> Poll<NodeHandlerEvent<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 moreAuto Trait Implementations
impl<TProtoHandler> !RefUnwindSafe for NodeHandlerWrapper<TProtoHandler>
impl<TProtoHandler> Send for NodeHandlerWrapper<TProtoHandler>where
TProtoHandler: Send,
<<TProtoHandler as ProtocolsHandler>::InboundProtocol as InboundUpgrade<<TProtoHandler as ProtocolsHandler>::Substream>>::Future: Send,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as OutboundUpgrade<<TProtoHandler as ProtocolsHandler>::Substream>>::Future: Send,
<TProtoHandler as ProtocolsHandler>::InboundProtocol: Send,
<<TProtoHandler as ProtocolsHandler>::InboundProtocol as UpgradeInfo>::Info: Send,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as UpgradeInfo>::Info: Send,
<<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as UpgradeInfo>::InfoIter as IntoIterator>::IntoIter: Send,
<TProtoHandler as ProtocolsHandler>::OutboundOpenInfo: Send,
<TProtoHandler as ProtocolsHandler>::OutboundProtocol: Send,
<TProtoHandler as ProtocolsHandler>::Substream: Send,
impl<TProtoHandler> Sync for NodeHandlerWrapper<TProtoHandler>where
TProtoHandler: Sync,
<<TProtoHandler as ProtocolsHandler>::InboundProtocol as InboundUpgrade<<TProtoHandler as ProtocolsHandler>::Substream>>::Future: Sync,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as OutboundUpgrade<<TProtoHandler as ProtocolsHandler>::Substream>>::Future: Sync,
<TProtoHandler as ProtocolsHandler>::InboundProtocol: Sync,
<<TProtoHandler as ProtocolsHandler>::InboundProtocol as UpgradeInfo>::Info: Sync,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as UpgradeInfo>::Info: Sync,
<<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as UpgradeInfo>::InfoIter as IntoIterator>::IntoIter: Sync,
<TProtoHandler as ProtocolsHandler>::OutboundOpenInfo: Sync,
<TProtoHandler as ProtocolsHandler>::OutboundProtocol: Sync,
<TProtoHandler as ProtocolsHandler>::Substream: Sync,
impl<TProtoHandler> Unpin for NodeHandlerWrapper<TProtoHandler>where
TProtoHandler: Unpin,
<<TProtoHandler as ProtocolsHandler>::InboundProtocol as InboundUpgrade<<TProtoHandler as ProtocolsHandler>::Substream>>::Future: Unpin,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as OutboundUpgrade<<TProtoHandler as ProtocolsHandler>::Substream>>::Future: Unpin,
<TProtoHandler as ProtocolsHandler>::InboundProtocol: Unpin,
<<TProtoHandler as ProtocolsHandler>::InboundProtocol as UpgradeInfo>::Info: Unpin,
<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as UpgradeInfo>::Info: Unpin,
<<<TProtoHandler as ProtocolsHandler>::OutboundProtocol as UpgradeInfo>::InfoIter as IntoIterator>::IntoIter: Unpin,
<TProtoHandler as ProtocolsHandler>::OutboundOpenInfo: Unpin,
<TProtoHandler as ProtocolsHandler>::OutboundProtocol: Unpin,
<TProtoHandler as ProtocolsHandler>::Substream: Unpin,
impl<TProtoHandler> !UnwindSafe for NodeHandlerWrapper<TProtoHandler>
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