iced/futures/src/executor/null.rs
2020-02-05 04:14:26 +01:00

19 lines
470 B
Rust

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) {}
}