iced-yoda/futures/src/executor/null.rs

20 lines
470 B
Rust
Raw Normal View History

use crate::Executor;
use futures::Future;
2020-01-20 09:49:17 +01:00
/// 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) {}
}