Add Application::Executor associated type
This commit is contained in:
parent
35760ac68f
commit
90690702e1
29 changed files with 195 additions and 72 deletions
19
futures/src/executor/tokio.rs
Normal file
19
futures/src/executor/tokio.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use crate::Executor;
|
||||
|
||||
use futures::Future;
|
||||
|
||||
pub type Tokio = tokio::runtime::Runtime;
|
||||
|
||||
impl Executor for Tokio {
|
||||
fn new() -> Result<Self, futures::io::Error> {
|
||||
tokio::runtime::Runtime::new()
|
||||
}
|
||||
|
||||
fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
|
||||
let _ = tokio::runtime::Runtime::spawn(self, future);
|
||||
}
|
||||
|
||||
fn enter<R>(&self, f: impl FnOnce() -> R) -> R {
|
||||
tokio::runtime::Runtime::enter(self, f)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue