diff options
author | 2021-10-21 22:42:14 +0300 | |
---|---|---|
committer | 2022-01-28 21:37:14 +0700 | |
commit | bdca20fc4a3e8f6bd8ffb59de75e6ca0f8a94b6a (patch) | |
tree | 8ea0d2ff0a0d780ff763d7491fc67878f549a615 /futures/src/runtime.rs | |
parent | c75ed37148b019358b0297171cf31b2577eeb9ae (diff) | |
download | iced-bdca20fc4a3e8f6bd8ffb59de75e6ca0f8a94b6a.tar.gz iced-bdca20fc4a3e8f6bd8ffb59de75e6ca0f8a94b6a.tar.bz2 iced-bdca20fc4a3e8f6bd8ffb59de75e6ca0f8a94b6a.zip |
Experimental wgpu WebGL backend support
- Added missing `draw_cache_align_4x4` call for `brush_glyph` on wasm32 target
- Added WebGL support to `integratio_wgpu` example
- Fixed test.yml CI workflow
- Removed spir-v shader in `integration_wgpu`; Fixed formatting
- Removed redundant `BoxStream` typedef
Diffstat (limited to 'futures/src/runtime.rs')
-rw-r--r-- | futures/src/runtime.rs | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/futures/src/runtime.rs b/futures/src/runtime.rs index 7779e235..96104cd9 100644 --- a/futures/src/runtime.rs +++ b/futures/src/runtime.rs @@ -5,6 +5,50 @@ use crate::{subscription, Executor, Subscription}; use futures::{channel::mpsc, Sink}; use std::marker::PhantomData; +#[cfg(not(target_arch = "wasm32"))] +mod trait_aliases { + use super::*; + + pub trait RuntimeMessage: Send + 'static {} + + impl<T> RuntimeMessage for T where T: Send + 'static {} + + pub trait RuntimeMessageSender<Message: RuntimeMessage>: + Sink<Message, Error = mpsc::SendError> + Unpin + Send + Clone + 'static + { + } + + impl<Message: RuntimeMessage, T> RuntimeMessageSender<Message> for T where + T: Sink<Message, Error = mpsc::SendError> + + Unpin + + Send + + Clone + + 'static + { + } +} + +#[cfg(target_arch = "wasm32")] +mod trait_aliases { + use super::*; + + pub trait RuntimeMessage: 'static {} + + impl<T> RuntimeMessage for T where T: 'static {} + + pub trait RuntimeMessageSender<Message: RuntimeMessage>: + Sink<Message, Error = mpsc::SendError> + Unpin + Clone + 'static + { + } + + impl<Message: RuntimeMessage, T> RuntimeMessageSender<Message> for T where + T: Sink<Message, Error = mpsc::SendError> + Unpin + Clone + 'static + { + } +} + +pub use trait_aliases::{RuntimeMessage, RuntimeMessageSender}; + /// A batteries-included runtime of commands and subscriptions. /// /// If you have an [`Executor`], a [`Runtime`] can be leveraged to run any @@ -23,9 +67,8 @@ where Hasher: std::hash::Hasher + Default, Event: Send + Clone + 'static, Executor: self::Executor, - Sender: - Sink<Message, Error = mpsc::SendError> + Unpin + Send + Clone + 'static, - Message: Send + 'static, + Sender: RuntimeMessageSender<Message>, + Message: RuntimeMessage, { /// Creates a new empty [`Runtime`]. /// |