Trait libp2p_swarm::handler::IntoConnectionHandler
source · pub trait IntoConnectionHandler: Send + 'static {
type Handler: ConnectionHandler;
// Required methods
fn into_handler(
self,
remote_peer_id: &PeerId,
connected_point: &ConnectedPoint
) -> Self::Handler;
fn inbound_protocol(
&self
) -> <Self::Handler as ConnectionHandler>::InboundProtocol;
// Provided method
fn select<TProto2>(
self,
other: TProto2
) -> IntoConnectionHandlerSelect<Self, TProto2>
where Self: Sized { ... }
}
👎Deprecated: Implement
ConnectionHandler
directly and use NetworkBehaviour::{handle_pending_inbound_connection,handle_pending_outbound_connection}
to handle pending connections.Expand description
Prototype for a ConnectionHandler
.
Required Associated Types§
sourcetype Handler: ConnectionHandler
type Handler: ConnectionHandler
👎Deprecated: Implement
ConnectionHandler
directly and use NetworkBehaviour::{handle_pending_inbound_connection,handle_pending_outbound_connection}
to handle pending connections.The protocols handler.
Required Methods§
sourcefn 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
👎Deprecated: Implement
ConnectionHandler
directly and use NetworkBehaviour::{handle_pending_inbound_connection,handle_pending_outbound_connection}
to handle pending connections.Builds the protocols handler.
The PeerId
is the id of the node the handler is going to handle.
sourcefn inbound_protocol(
&self
) -> <Self::Handler as ConnectionHandler>::InboundProtocol
fn inbound_protocol( &self ) -> <Self::Handler as ConnectionHandler>::InboundProtocol
👎Deprecated: Implement
ConnectionHandler
directly and use NetworkBehaviour::{handle_pending_inbound_connection,handle_pending_outbound_connection}
to handle pending connections.Return the handler’s inbound protocol.
Provided Methods§
sourcefn select<TProto2>(
self,
other: TProto2
) -> IntoConnectionHandlerSelect<Self, TProto2>where
Self: Sized,
fn select<TProto2>( self, other: TProto2 ) -> IntoConnectionHandlerSelect<Self, TProto2>where Self: Sized,
👎Deprecated: Implement
ConnectionHandler
directly and use NetworkBehaviour::{handle_pending_inbound_connection,handle_pending_outbound_connection}
to handle pending connections.Builds an implementation of IntoConnectionHandler
that handles both this protocol and the
other one together.
Implementors§
source§impl<K, H> IntoConnectionHandler for IntoMultiHandler<K, H>where
K: Debug + Clone + Eq + Hash + Send + 'static,
H: IntoConnectionHandler,
impl<K, H> IntoConnectionHandler for IntoMultiHandler<K, H>where K: Debug + Clone + Eq + Hash + Send + 'static, H: IntoConnectionHandler,
type Handler = MultiHandler<K, <H as IntoConnectionHandler>::Handler>
source§impl<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.