Add smol async runtime
This commit is contained in:
parent
92d647d1a6
commit
b2415eee61
8 changed files with 104 additions and 11 deletions
18
futures/src/executor/smol.rs
Normal file
18
futures/src/executor/smol.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use crate::Executor;
|
||||
|
||||
use futures::Future;
|
||||
|
||||
/// A `smol` runtime.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "smol")))]
|
||||
#[derive(Debug)]
|
||||
pub struct Smol;
|
||||
|
||||
impl Executor for Smol {
|
||||
fn new() -> Result<Self, futures::io::Error> {
|
||||
Ok(Self)
|
||||
}
|
||||
|
||||
fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
|
||||
smol::spawn(future).detach();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue