mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 17:41:22 +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:
@ -24,7 +24,7 @@ use crate::behaviour::{
|
||||
};
|
||||
use crate::{
|
||||
ConnectionHandler, ConnectionId, IntoConnectionHandler, NetworkBehaviour,
|
||||
NetworkBehaviourAction, PollParameters,
|
||||
NetworkBehaviourAction, PollParameters, THandlerOutEvent,
|
||||
};
|
||||
use libp2p_core::{multiaddr::Multiaddr, transport::ListenerId, ConnectedPoint, PeerId};
|
||||
use std::collections::HashMap;
|
||||
@ -107,8 +107,7 @@ where
|
||||
&mut self,
|
||||
_peer_id: PeerId,
|
||||
_connection_id: ConnectionId,
|
||||
_event: <<Self::ConnectionHandler as IntoConnectionHandler>::Handler as
|
||||
ConnectionHandler>::OutEvent,
|
||||
_event: THandlerOutEvent<Self>,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@ -455,7 +454,7 @@ where
|
||||
&mut self,
|
||||
p: PeerId,
|
||||
c: ConnectionId,
|
||||
e: <<Self::ConnectionHandler as IntoConnectionHandler>::Handler as ConnectionHandler>::OutEvent,
|
||||
e: THandlerOutEvent<Self>,
|
||||
) {
|
||||
assert!(
|
||||
self.on_connection_established
|
||||
|
Reference in New Issue
Block a user