Skip to main content

v_storage/runtime_wrapper/
mod.rs

1// src/runtime_wrapper/mod.rs
2
3pub struct RuntimeWrapper {
4    pub runtime: tokio::runtime::Runtime,
5}
6
7impl RuntimeWrapper {
8    pub fn new() -> Self {
9        let runtime = tokio::runtime::Runtime::new().unwrap();
10        RuntimeWrapper { runtime }
11    }
12
13    pub fn version(&self) -> &'static str {
14        "tokio 1.0"
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}