Add smol async runtime

This commit is contained in:
Jayce Fayne 2021-01-13 01:48:35 +01:00
parent 92d647d1a6
commit b2415eee61
8 changed files with 104 additions and 11 deletions

View 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();
}
}