Skip to content

Commit 5137e4e

Browse files
P1Rdariusc93
andauthored
refactor(examples): use tokio instead of async-std in identify example (#5579)
## Description <!-- Please write a summary of your changes and why you made them. This section will appear as the commit message after merging. Please craft it accordingly. For a quick primer on good commit messages, check out this blog post: https://cbea.ms/git-commit/ Please include any relevant issues in here, for example: Related https://github.com/libp2p/rust-libp2p/issues/ABCD. Fixes https://github.com/libp2p/rust-libp2p/issues/XYZ. --> Following on issue #4449 refactor: use tokio instead of async-std in the identify example and remove unnecesary dependencies ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR which don't need to go into the final commit message. --> ## Change checklist * Removed unnecessary dependencies on examples/identify/Cargo.toml <!-- Please add a Changelog entry in the appropriate crates and bump the crate versions if needed. See <https://github.com/libp2p/rust-libp2p/blob/master/docs/release.md#development-between-releases>--> - [x] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] A changelog entry has been made in the appropriate crates --------- Co-authored-by: David E. Perez Negron R. <[email protected]> Co-authored-by: Darius Clark <[email protected]>
1 parent 93169cc commit 5137e4e

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/identify/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ license = "MIT"
99
release = false
1010

1111
[dependencies]
12-
async-std = { version = "1.12", features = ["attributes"] }
13-
async-trait = "0.1"
12+
tokio = { version = "1.37.0", features = ["full"] }
1413
futures = { workspace = true }
15-
libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "relay", "rendezvous", "tcp", "tokio","yamux"] }
14+
libp2p = { path = "../../libp2p", features = ["identify", "noise", "tcp", "tokio", "yamux"] }
1615
tracing = { workspace = true }
1716
tracing-subscriber = { workspace = true, features = ["env-filter"] }
1817

examples/identify/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ use libp2p::{core::multiaddr::Multiaddr, identify, noise, swarm::SwarmEvent, tcp
2525
use std::{error::Error, time::Duration};
2626
use tracing_subscriber::EnvFilter;
2727

28-
#[async_std::main]
28+
#[tokio::main]
2929
async fn main() -> Result<(), Box<dyn Error>> {
3030
let _ = tracing_subscriber::fmt()
3131
.with_env_filter(EnvFilter::from_default_env())
3232
.try_init();
3333

3434
let mut swarm = libp2p::SwarmBuilder::with_new_identity()
35-
.with_async_std()
35+
.with_tokio()
3636
.with_tcp(
3737
tcp::Config::default(),
3838
noise::Config::new,

0 commit comments

Comments
 (0)