Do you struggle with any of the following symptoms?
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.
toml
[dependencies]
untokio = { version = "0.2", features = ["v02"] }
rust
untokio::v02::spawn(async {
// code requiring a tokio 0.2 runtime
reqwest::get("http://example.com/").await?.text().await
}).await.unwrap()
toml
[dependencies]
untokio = { version = "0.2", features = ["v03"] }
rust
untokio::v03::spawn(async{
// code requiring a tokio 0.3 runtime
tokio::fs::read_to_string("Cargo.toml").await
}).await.unwrap()
toml
[dependencies]
untokio = { version = "0.2", features = ["v1"] }
rust
untokio::v1::spawn(async{
// code requiring a tokio 1.x runtime
tokio::fs::read_to_string("Cargo.toml").await
}).await.unwrap()
Licensed under either of
at your option.
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.