mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-28 01:01:34 +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:
@ -21,6 +21,7 @@
|
||||
use crate::behaviour::{self, NetworkBehaviour, NetworkBehaviourAction, PollParameters};
|
||||
use crate::connection::ConnectionId;
|
||||
use crate::handler::either::IntoEitherHandler;
|
||||
use crate::THandlerOutEvent;
|
||||
use either::Either;
|
||||
use libp2p_core::{Multiaddr, PeerId};
|
||||
use std::{task::Context, task::Poll};
|
||||
@ -71,7 +72,7 @@ where
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
connection_id: ConnectionId,
|
||||
event: crate::THandlerOutEvent<Self>,
|
||||
event: THandlerOutEvent<Self>,
|
||||
) {
|
||||
match (self, event) {
|
||||
(Either::Left(left), Either::Left(event)) => {
|
||||
|
Reference in New Issue
Block a user