pub struct ProtocolsHandlerSelect<TProto1, TProto2> { /* private fields */ }
Expand description
Implementation of ProtocolsHandler
that combines two protocols into one.
Trait Implementations
sourceimpl<TProto1: Clone, TProto2: Clone> Clone for ProtocolsHandlerSelect<TProto1, TProto2>
impl<TProto1: Clone, TProto2: Clone> Clone for ProtocolsHandlerSelect<TProto1, TProto2>
sourcefn clone(&self) -> ProtocolsHandlerSelect<TProto1, TProto2>
fn clone(&self) -> ProtocolsHandlerSelect<TProto1, TProto2>
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 moresourceimpl<TProto1: Debug, TProto2: Debug> Debug for ProtocolsHandlerSelect<TProto1, TProto2>
impl<TProto1: Debug, TProto2: Debug> Debug for ProtocolsHandlerSelect<TProto1, TProto2>
sourceimpl<TSubstream, TProto1, TProto2> ProtocolsHandler for ProtocolsHandlerSelect<TProto1, TProto2>where
TProto1: ProtocolsHandler<Substream = TSubstream>,
TProto2: ProtocolsHandler<Substream = TSubstream>,
TSubstream: AsyncRead + AsyncWrite,
TProto1::InboundProtocol: InboundUpgrade<TSubstream>,
TProto2::InboundProtocol: InboundUpgrade<TSubstream>,
TProto1::OutboundProtocol: OutboundUpgrade<TSubstream>,
TProto2::OutboundProtocol: OutboundUpgrade<TSubstream>,
impl<TSubstream, TProto1, TProto2> ProtocolsHandler for ProtocolsHandlerSelect<TProto1, TProto2>where
TProto1: ProtocolsHandler<Substream = TSubstream>,
TProto2: ProtocolsHandler<Substream = TSubstream>,
TSubstream: AsyncRead + AsyncWrite,
TProto1::InboundProtocol: InboundUpgrade<TSubstream>,
TProto2::InboundProtocol: InboundUpgrade<TSubstream>,
TProto1::OutboundProtocol: OutboundUpgrade<TSubstream>,
TProto2::OutboundProtocol: OutboundUpgrade<TSubstream>,
type InEvent = EitherOutput<<TProto1 as ProtocolsHandler>::InEvent, <TProto2 as ProtocolsHandler>::InEvent>
type InEvent = EitherOutput<<TProto1 as ProtocolsHandler>::InEvent, <TProto2 as ProtocolsHandler>::InEvent>
Custom event that can be received from the outside.
type OutEvent = EitherOutput<<TProto1 as ProtocolsHandler>::OutEvent, <TProto2 as ProtocolsHandler>::OutEvent>
type OutEvent = EitherOutput<<TProto1 as ProtocolsHandler>::OutEvent, <TProto2 as ProtocolsHandler>::OutEvent>
Custom event that can be produced by the handler and that will be returned to the outside.
type Error = EitherError<<TProto1 as ProtocolsHandler>::Error, <TProto2 as ProtocolsHandler>::Error>
type Error = EitherError<<TProto1 as ProtocolsHandler>::Error, <TProto2 as ProtocolsHandler>::Error>
Error that can happen when polling.
type Substream = TSubstream
type Substream = TSubstream
The type of the substream that contains the raw data.
type InboundProtocol = SelectUpgrade<<TProto1 as ProtocolsHandler>::InboundProtocol, <TProto2 as ProtocolsHandler>::InboundProtocol>
type InboundProtocol = SelectUpgrade<<TProto1 as ProtocolsHandler>::InboundProtocol, <TProto2 as ProtocolsHandler>::InboundProtocol>
The upgrade for the protocol or protocols handled by this handler.
type OutboundProtocol = EitherUpgrade<<TProto1 as ProtocolsHandler>::OutboundProtocol, <TProto2 as ProtocolsHandler>::OutboundProtocol>
type OutboundProtocol = EitherUpgrade<<TProto1 as ProtocolsHandler>::OutboundProtocol, <TProto2 as ProtocolsHandler>::OutboundProtocol>
The upgrade for the protocol or protocols handled by this handler.
type OutboundOpenInfo = EitherOutput<<TProto1 as ProtocolsHandler>::OutboundOpenInfo, <TProto2 as ProtocolsHandler>::OutboundOpenInfo>
type OutboundOpenInfo = EitherOutput<<TProto1 as ProtocolsHandler>::OutboundOpenInfo, <TProto2 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 morefn inject_fully_negotiated_outbound(
&mut self,
protocol: <Self::OutboundProtocol as OutboundUpgrade<TSubstream>>::Output,
endpoint: Self::OutboundOpenInfo
)
sourcefn inject_fully_negotiated_inbound(
&mut self,
protocol: <Self::InboundProtocol as InboundUpgrade<TSubstream>>::Output
)
fn inject_fully_negotiated_inbound(
&mut self,
protocol: <Self::InboundProtocol as InboundUpgrade<TSubstream>>::Output
)
Injects a fully-negotiated substream in the handler. 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 in the handler.
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 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 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<TProto1, TProto2> RefUnwindSafe for ProtocolsHandlerSelect<TProto1, TProto2>where
TProto1: RefUnwindSafe,
TProto2: RefUnwindSafe,
impl<TProto1, TProto2> Send for ProtocolsHandlerSelect<TProto1, TProto2>where
TProto1: Send,
TProto2: Send,
impl<TProto1, TProto2> Sync for ProtocolsHandlerSelect<TProto1, TProto2>where
TProto1: Sync,
TProto2: Sync,
impl<TProto1, TProto2> Unpin for ProtocolsHandlerSelect<TProto1, TProto2>where
TProto1: Unpin,
TProto2: Unpin,
impl<TProto1, TProto2> UnwindSafe for ProtocolsHandlerSelect<TProto1, TProto2>where
TProto1: UnwindSafe,
TProto2: 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