Replace tokio with async-std in your Cargo.toml and update your imports to use async_std instead of tokio.
[dependencies]
async-std = { version = "1.12", features = ["attributes"] }
use async_std::task;
#[async_std::main]
async fn main() {
println!("Hello from async-std!");
}
- Add
async-stdto yourCargo.tomldependencies with theattributesfeature enabled. - Replace
#[tokio::main]with#[async_std::main]in your entry point. - Change all
use tokio::...imports touse async_std::.... - Run your application with
cargo runto verify the switch.