eminfedar
eminfedar

Reputation: 668

Rust - async-std's "tokio1" feature, how it works?

There is a feature flag on async-std: tokio1

async-std = { version = "1", features = ["tokio1", "attributes"] }

Then I can use async_std::main on tokio stuff:

#[async_std::main]
async fn main() -> std::io::Result<()> {
    
    // some tokio dependent async libraries run here

    Ok(())
}

Basically it makes tokio dependent crates run with async-std crate.

I have two questions:

  1. How does it work? (what is happening in the background?)
  2. Does it affect the performance to mimic tokio libraries or it is just zero cost abstraction?

Upvotes: 2

Views: 414

Answers (0)

Related Questions