protocols/ping: Properly deprecate types with Ping prefix (#2937)

Co-authored-by: Elena Frank <elena.frank@protonmail.com>
Co-authored-by:  João Oliveira <hello@jxs.pt>
This commit is contained in:
Thomas Eizinger
2022-10-01 00:19:34 +10:00
committed by GitHub
parent cce296e55e
commit 1da75b2b25
17 changed files with 162 additions and 159 deletions

View File

@ -26,16 +26,16 @@
//!
//! # Usage
//!
//! The [`Ping`] struct implements the [`NetworkBehaviour`] trait. When used with a [`Swarm`],
//! The [`Behaviour`] struct implements the [`NetworkBehaviour`] trait. When used with a [`Swarm`],
//! it will respond to inbound ping requests and as necessary periodically send outbound
//! ping requests on every established connection. If a configurable number of consecutive
//! pings fail, the connection will be closed.
//!
//! The `Ping` network behaviour produces [`PingEvent`]s, which may be consumed from the `Swarm`
//! The [`Behaviour`] network behaviour produces [`Event`]s, which may be consumed from the [`Swarm`]
//! by an application, e.g. to collect statistics.
//!
//! > **Note**: The ping protocol does not keep otherwise idle connections alive
//! > by default, see [`PingConfig::with_keep_alive`] for changing this behaviour.
//! > by default, see [`Config::with_keep_alive`] for changing this behaviour.
//!
//! [`Swarm`]: libp2p_swarm::Swarm
//! [`Transport`]: libp2p_core::Transport
@ -52,16 +52,25 @@ use std::{
task::{Context, Poll},
};
#[deprecated(
since = "0.30.0",
note = "Use re-exports that omit `Ping` prefix, i.e. `libp2p::ping::Config` etc"
)]
pub use self::{
protocol::PROTOCOL_NAME, Config as PingConfig, Event as PingEvent, Failure as PingFailure,
Result as PingResult, Success as PingSuccess,
};
#[deprecated(since = "0.30.0", note = "Use libp2p::ping::Behaviour instead.")]
pub use Behaviour as Ping;
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Config instead.")]
pub type PingConfig = Config;
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Event instead.")]
pub type PingEvent = Event;
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Success instead.")]
pub type PingSuccess = Success;
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Failure instead.")]
pub type PingFailure = Failure;
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Result instead.")]
pub type PingResult = Result;
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Behaviour instead.")]
pub type Ping = Behaviour;
pub use self::protocol::PROTOCOL_NAME;
/// The result of an inbound or outbound ping.
pub type Result = std::result::Result<Success, Failure>;