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

@@ -25,7 +25,6 @@ use libp2p::identify::Identify;
use libp2p::identify::IdentifyConfig;
use libp2p::identify::IdentifyEvent;
use libp2p::ping;
use libp2p::ping::{Ping, PingEvent};
use libp2p::swarm::{Swarm, SwarmEvent};
use libp2p::NetworkBehaviour;
use libp2p::{development_transport, rendezvous};
@@ -54,7 +53,7 @@ async fn main() {
identity.public(),
)),
rendezvous: rendezvous::server::Behaviour::new(rendezvous::server::Config::default()),
ping: Ping::new(ping::Config::new().with_keep_alive(true)),
ping: ping::Behaviour::new(ping::Config::new().with_keep_alive(true)),
},
PeerId::from(identity.public()),
);
@@ -104,7 +103,7 @@ async fn main() {
#[derive(Debug)]
enum MyEvent {
Rendezvous(rendezvous::server::Event),
Ping(PingEvent),
Ping(ping::Event),
Identify(IdentifyEvent),
}
@@ -114,8 +113,8 @@ impl From<rendezvous::server::Event> for MyEvent {
}
}
impl From<PingEvent> for MyEvent {
fn from(event: PingEvent) -> Self {
impl From<ping::Event> for MyEvent {
fn from(event: ping::Event) -> Self {
MyEvent::Ping(event)
}
}
@@ -132,5 +131,5 @@ impl From<IdentifyEvent> for MyEvent {
struct MyBehaviour {
identify: Identify,
rendezvous: rendezvous::server::Behaviour,
ping: Ping,
ping: ping::Behaviour,
}