untokio

Crates.iountokio
lib.rsuntokio
version0.2.1
sourcesrc
created_at2020-10-26 12:14:47.377769
updated_at2021-03-10 23:47:54.465969
descriptionAutomatically create tokio runtimes
homepage
repositoryhttps://github.com/MaulingMonkey/untokio
max_upload_size
id305598
size61,211
(MaulingMonkey)

documentation

https://docs.rs/untokio/

README

untokio: pretend tokio doesn't exist

GitHub crates.io docs.rs License Build Status

Do you struggle with any of the following symptoms?

  • Ennui triggered by the thought of inflicting tokio::main or tokio runtime management on users of your library
  • Indecision about what runtime configuration you should use for your runtimes?
  • thread 'main' panicked at 'not currently running on the Tokio runtime.'

Struggle no more, with untokio! untokio will automatically create a runtime so you don't have to.

example: tokio = "0.2", reqwest = "0.10"

[dependencies]
untokio = { version = "0.2", features = ["v02"] }
untokio::v02::spawn(async {
    // code requiring a tokio 0.2 runtime
    reqwest::get("http://example.com/").await?.text().await
}).await.unwrap()

example: tokio = "0.3"

[dependencies]
untokio = { version = "0.2", features = ["v03"] }
untokio::v03::spawn(async{
    // code requiring a tokio 0.3 runtime
    tokio::fs::read_to_string("Cargo.toml").await
}).await.unwrap()

example: tokio = "1"

[dependencies]
untokio = { version = "0.2", features = ["v1"] }
untokio::v1::spawn(async{
    // code requiring a tokio 1.x runtime
    tokio::fs::read_to_string("Cargo.toml").await
}).await.unwrap()

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 15

cargo fmt