mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-14 02:21:21 +00:00
refactor: expose and use THandlerOutEvent
type alias (#3368)
Previously, we used the full reference to the `OutEvent` of the `ConnectionHandler` in all implementations of `NetworkBehaviour`. Not only is this very verbose, it is also more brittle to changes. With the current implementation plan for #2824, we will be removing the `IntoConnectionHandler` abstraction. Using a type-alias to refer to the `OutEvent` makes the migration much easier.
This commit is contained in:
@ -4,6 +4,7 @@ use crate::handler::{
|
||||
ConnectionEvent, ConnectionHandlerEvent, FullyNegotiatedInbound, FullyNegotiatedOutbound,
|
||||
KeepAlive, SubstreamProtocol,
|
||||
};
|
||||
use crate::THandlerOutEvent;
|
||||
use libp2p_core::upgrade::DeniedUpgrade;
|
||||
use libp2p_core::PeerId;
|
||||
use std::task::{Context, Poll};
|
||||
@ -26,7 +27,12 @@ impl NetworkBehaviour for Behaviour {
|
||||
ConnectionHandler
|
||||
}
|
||||
|
||||
fn on_connection_handler_event(&mut self, _: PeerId, _: ConnectionId, event: Void) {
|
||||
fn on_connection_handler_event(
|
||||
&mut self,
|
||||
_: PeerId,
|
||||
_: ConnectionId,
|
||||
event: THandlerOutEvent<Self>,
|
||||
) {
|
||||
void::unreachable(event)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user