diff options
author | 2022-01-28 18:24:07 +0700 | |
---|---|---|
committer | 2022-01-28 21:37:17 +0700 | |
commit | 167be45a7db7c1f60a79116766bdf38300429c6a (patch) | |
tree | 5af48807c8d90a73775fef68a51ae549880aa388 /futures/src/backend/null.rs | |
parent | 5dab5a327ef643ee38ac3e42ab35212fff445631 (diff) | |
download | iced-167be45a7db7c1f60a79116766bdf38300429c6a.tar.gz iced-167be45a7db7c1f60a79116766bdf38300429c6a.tar.bz2 iced-167be45a7db7c1f60a79116766bdf38300429c6a.zip |
Split `iced_futures` into different `backend` implementations
Diffstat (limited to 'futures/src/backend/null.rs')
-rw-r--r-- | futures/src/backend/null.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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<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) {} +} |