From 167be45a7db7c1f60a79116766bdf38300429c6a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 28 Jan 2022 18:24:07 +0700 Subject: Split `iced_futures` into different `backend` implementations --- futures/src/backend/null.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 futures/src/backend/null.rs (limited to 'futures/src/backend/null.rs') diff --git a/futures/src/backend/null.rs b/futures/src/backend/null.rs new file mode 100644 index 00000000..e22e7921 --- /dev/null +++ b/futures/src/backend/null.rs @@ -0,0 +1,18 @@ +//! A backend that does nothing! +use futures::Future; + +/// An executor that drops all the futures, instead of spawning them. +#[derive(Debug)] +pub struct Executor; + +impl crate::Executor for Executor { + fn new() -> Result { + Ok(Self) + } + + #[cfg(not(target_arch = "wasm32"))] + fn spawn(&self, _future: impl Future + Send + 'static) {} + + #[cfg(target_arch = "wasm32")] + fn spawn(&self, _future: impl Future + 'static) {} +} -- cgit