tokio-global

Build Crates.io Documentation

Simple way to create global tokio runtime, available from any place in code

Usage

toml [dependencies.tokio-global] version = "0.2" features = ["single"] #or multi for multithreaded runtim

Start runtime and use AutoRuntime trait to run your futures:

```rust use tokioglobal::single as rt; use tokioglobal::AutoRuntime;

let _guard = rt::init(); //Now we can exeute futures using runtime //When guard goes out of scope though, //we no longer can use it.

let result = futures::future::ok::(5).finish().expect("Ok"); assert_eq!(result, 5);

```