pub trait IntoProtocolsHandler: Send + 'static {
type Handler: ProtocolsHandler;
// Required methods
fn into_handler(
self,
remote_peer_id: &PeerId,
connected_point: &ConnectedPoint,
) -> Self::Handler;
fn inbound_protocol(
&self,
) -> <Self::Handler as ProtocolsHandler>::InboundProtocol;
// Provided methods
fn select<TProto2>(
self,
other: TProto2,
) -> IntoProtocolsHandlerSelect<Self, TProto2>
where Self: Sized { ... }
fn into_node_handler_builder(self) -> NodeHandlerWrapperBuilder<Self>
where Self: Sized { ... }
}
Expand description
Prototype for a ProtocolsHandler
.
Required Associated Types§
Sourcetype Handler: ProtocolsHandler
type Handler: ProtocolsHandler
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
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 ProtocolsHandler>::InboundProtocol
fn inbound_protocol( &self, ) -> <Self::Handler as ProtocolsHandler>::InboundProtocol
Return the handler’s inbound protocol.
Provided Methods§
Sourcefn select<TProto2>(
self,
other: TProto2,
) -> IntoProtocolsHandlerSelect<Self, TProto2>where
Self: Sized,
fn select<TProto2>(
self,
other: TProto2,
) -> IntoProtocolsHandlerSelect<Self, TProto2>where
Self: Sized,
Builds an implementation of IntoProtocolsHandler
that handles both this protocol and the
other one together.
Sourcefn 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.