mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-31 00:41:59 +00:00
swarm/behaviour: Remove deprecated NetworkBehaviourEventProcess (#2840)
Removes the `NetworkBehaviourEventProcess` and all its associated logic. See deprecation pull request https://github.com/libp2p/rust-libp2p/pull/2784. Find rational in https://github.com/libp2p/rust-libp2p/pull/2751.
This commit is contained in:
@@ -321,24 +321,6 @@ pub trait PollParameters {
|
||||
fn local_peer_id(&self) -> &PeerId;
|
||||
}
|
||||
|
||||
/// When deriving [`NetworkBehaviour`] this trait must by default be implemented for all the
|
||||
/// possible event types generated by the inner behaviours.
|
||||
///
|
||||
/// You can opt out of this behaviour through `#[behaviour(event_process = false)]`. See the
|
||||
/// documentation of [`NetworkBehaviour`] for details.
|
||||
#[deprecated(
|
||||
since = "0.38.0",
|
||||
note = "Use `#[behaviour(out_event = \"MyBehaviourEvent\")]` instead. See \
|
||||
https://github.com/libp2p/rust-libp2p/blob/master/swarm/CHANGELOG.md#0380 \
|
||||
for instructions on how to migrate. Will be removed with \
|
||||
https://github.com/libp2p/rust-libp2p/pull/2751."
|
||||
)]
|
||||
pub trait NetworkBehaviourEventProcess<TEvent> {
|
||||
/// Called when one of the fields of the type you're deriving `NetworkBehaviour` on generates
|
||||
/// an event.
|
||||
fn inject_event(&mut self, event: TEvent);
|
||||
}
|
||||
|
||||
/// An action that a [`NetworkBehaviour`] can trigger in the [`Swarm`]
|
||||
/// in whose context it is executing.
|
||||
///
|
||||
|
@@ -19,8 +19,6 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
use crate::handler::{either::IntoEitherHandler, ConnectionHandler, IntoConnectionHandler};
|
||||
#[allow(deprecated)]
|
||||
pub use crate::NetworkBehaviourEventProcess;
|
||||
use crate::{DialError, NetworkBehaviour, NetworkBehaviourAction, PollParameters};
|
||||
use either::Either;
|
||||
use libp2p_core::{
|
||||
@@ -235,18 +233,3 @@ where
|
||||
Poll::Ready(event)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl<TEvent, TBehaviourLeft, TBehaviourRight> NetworkBehaviourEventProcess<TEvent>
|
||||
for Either<TBehaviourLeft, TBehaviourRight>
|
||||
where
|
||||
TBehaviourLeft: NetworkBehaviourEventProcess<TEvent>,
|
||||
TBehaviourRight: NetworkBehaviourEventProcess<TEvent>,
|
||||
{
|
||||
fn inject_event(&mut self, event: TEvent) {
|
||||
match self {
|
||||
Either::Left(a) => a.inject_event(event),
|
||||
Either::Right(b) => b.inject_event(event),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,8 +23,6 @@ use crate::handler::{
|
||||
KeepAlive, SubstreamProtocol,
|
||||
};
|
||||
use crate::upgrade::{InboundUpgradeSend, OutboundUpgradeSend, SendWrapper};
|
||||
#[allow(deprecated)]
|
||||
pub use crate::NetworkBehaviourEventProcess;
|
||||
use crate::{DialError, NetworkBehaviour, NetworkBehaviourAction, PollParameters};
|
||||
use either::Either;
|
||||
use libp2p_core::{
|
||||
@@ -232,18 +230,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl<TEvent, TBehaviour> NetworkBehaviourEventProcess<TEvent> for Toggle<TBehaviour>
|
||||
where
|
||||
TBehaviour: NetworkBehaviourEventProcess<TEvent>,
|
||||
{
|
||||
fn inject_event(&mut self, event: TEvent) {
|
||||
if let Some(inner) = self.inner.as_mut() {
|
||||
inner.inject_event(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of `IntoConnectionHandler` that can be in the disabled state.
|
||||
pub struct ToggleIntoConnectionHandler<TInner> {
|
||||
inner: Option<TInner>,
|
||||
|
@@ -63,8 +63,6 @@ pub mod behaviour;
|
||||
pub mod dial_opts;
|
||||
pub mod handler;
|
||||
|
||||
#[allow(deprecated)]
|
||||
pub use behaviour::NetworkBehaviourEventProcess;
|
||||
pub use behaviour::{
|
||||
CloseConnection, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters,
|
||||
};
|
||||
|
Reference in New Issue
Block a user