1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//!Provides you with global tokio runtimes
//!
//!It can be used from any point in code without need to manually pass around runtime itself
//!
//!## Tokio flavour
//!
//!In order to utilize the library you need to choose flavour of runtime
//!
//!At the moment there are two types:
//!
//!- Single threaded runtime - As name implies it is event loop on current thread. Available with
//!feature `single`.
//!- Multi threaded runtime - Tokio's default runtime that runs multiple event loops in pool of
//!threads. Available with feature `multi`.

pub extern crate tokio;
pub extern crate futures;

///Trait to bootstrap your futures.
pub trait AutoRuntime: futures::Future {
    ///Runs futures to completion.
    ///
    ///## Note
    ///
    ///It must not be used from within async context
    fn finish(self) -> Result<Self::Item, Self::Error>;
}

#[macro_use]
mod utils;

#[cfg(feature = "single")]
pub mod single;

#[cfg(feature = "multi")]
pub mod multi;