summaryrefslogtreecommitdiffstats
path: root/futures/src/executor/smol.rs
blob: deafd43a13395f217d063e1a887333f448827489 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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();
    }
}