summaryrefslogblamecommitdiffstats
path: root/futures/src/executor/null.rs
blob: 65e2e2dfe7d239cb51d27035536906f6b396310c (plain) (tree)
1
2
3
4
5
6



                    

                                                                     






                                                  
                                       
                                                                          


                                                                   
 
use crate::Executor;

use futures::Future;

/// An executor that drops all the futures, instead of spawning them.
#[derive(Debug)]
pub struct Null;

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

    #[cfg(not(target_arch = "wasm32"))]
    fn spawn(&self, _future: impl Future<Output = ()> + Send + 'static) {}

    #[cfg(target_arch = "wasm32")]
    fn spawn(&self, _future: impl Future<Output = ()> + 'static) {}
}