summaryrefslogtreecommitdiffstats
path: root/futures/src/executor/async_std.rs
blob: 471be369f634fe49d3ffa750de7d81a719e6301c (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;

/// An `async-std` runtime.
#[cfg_attr(docsrs, doc(cfg(feature = "async-std")))]
#[derive(Debug)]
pub struct AsyncStd;

impl Executor for AsyncStd {
    fn new() -> Result<Self, futures::io::Error> {
        Ok(Self)
    }

    fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
        let _ = async_std::task::spawn(future);
    }
}