Trait libp2p::swarm::IntoConnectionHandler
source · [−]pub trait IntoConnectionHandler: 'static + Send {
type Handler: ConnectionHandler;
fn into_handler(
self,
remote_peer_id: &PeerId,
connected_point: &ConnectedPoint
) -> Self::Handler;
fn inbound_protocol(
&self
) -> <Self::Handler as ConnectionHandler>::InboundProtocol;
fn select<TProto2>(
self,
other: TProto2
) -> IntoConnectionHandlerSelect<Self, TProto2> { ... }
}
Expand description
Prototype for a ConnectionHandler
.
Associated Types
The protocols handler.
Required methods
fn into_handler(
self,
remote_peer_id: &PeerId,
connected_point: &ConnectedPoint
) -> Self::Handler
fn into_handler(
self,
remote_peer_id: &PeerId,
connected_point: &ConnectedPoint
) -> Self::Handler
Builds the protocols handler.
The PeerId
is the id of the node the handler is going to handle.
fn inbound_protocol(
&self
) -> <Self::Handler as ConnectionHandler>::InboundProtocol
fn inbound_protocol(
&self
) -> <Self::Handler as ConnectionHandler>::InboundProtocol
Return the handler’s inbound protocol.
Provided methods
fn select<TProto2>(
self,
other: TProto2
) -> IntoConnectionHandlerSelect<Self, TProto2>
fn select<TProto2>(
self,
other: TProto2
) -> IntoConnectionHandlerSelect<Self, TProto2>
Builds an implementation of IntoConnectionHandler
that handles both this protocol and the
other one together.
Implementors
sourceimpl<K, H> IntoConnectionHandler for IntoMultiHandler<K, H> where
K: 'static + Debug + Clone + Eq + Hash + Send,
H: IntoConnectionHandler,
impl<K, H> IntoConnectionHandler for IntoMultiHandler<K, H> where
K: 'static + Debug + Clone + Eq + Hash + Send,
H: IntoConnectionHandler,
type Handler = MultiHandler<K, <H as IntoConnectionHandler>::Handler>
sourceimpl<L, R> IntoConnectionHandler for IntoEitherHandler<L, R> where
L: IntoConnectionHandler,
R: IntoConnectionHandler,
impl<L, R> IntoConnectionHandler for IntoEitherHandler<L, R> where
L: IntoConnectionHandler,
R: IntoConnectionHandler,
Implementation of a IntoConnectionHandler
that represents either of two IntoConnectionHandler
implementations.