Skip to main content

v_common/runtime_wrapper/
tokio_0_2.rs

1pub struct RuntimeWrapper {
2    pub runtime: tokio_dep_0_2::runtime::Runtime,
3}
4
5impl RuntimeWrapper {
6    pub fn new() -> Self {
7        let runtime = tokio_dep_0_2::runtime::Runtime::new().unwrap();
8        RuntimeWrapper {
9            runtime,
10        }
11    }
12
13    pub fn version(&self) -> &'static str {
14        "tokio 0.2"
15    }
16
17    pub fn block_on<F>(&mut self, future: F) -> F::Output
18    where
19        F: std::future::Future,
20    {
21        self.runtime.block_on(future)
22    }
23}