diff options
author | 2024-01-18 09:55:27 +0100 | |
---|---|---|
committer | 2024-01-18 09:55:27 +0100 | |
commit | 8bf238697226e827dc983f9d89afbd0e252c5254 (patch) | |
tree | 3594e998d60b130ab6b161aa00159e2311cbde0a /futures/src/maybe.rs | |
parent | 7289b6091b61b0aa448a756cfe32211c78a4cce0 (diff) | |
download | iced-8bf238697226e827dc983f9d89afbd0e252c5254.tar.gz iced-8bf238697226e827dc983f9d89afbd0e252c5254.tar.bz2 iced-8bf238697226e827dc983f9d89afbd0e252c5254.zip |
Remove `Compositor` window generic
And update `glyphon` and `window_clipboard`
Diffstat (limited to 'futures/src/maybe.rs')
-rw-r--r-- | futures/src/maybe.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/futures/src/maybe.rs b/futures/src/maybe.rs new file mode 100644 index 00000000..1a0bd1d1 --- /dev/null +++ b/futures/src/maybe.rs @@ -0,0 +1,35 @@ +#[cfg(not(target_arch = "wasm32"))] +mod platform { + /// An extension trait that enforces `Send` only on native platforms. + /// + /// Useful to write cross-platform async code! + pub trait MaybeSend: Send {} + + impl<T> MaybeSend for T where T: Send {} + + /// An extension trait that enforces `Sync` only on native platforms. + /// + /// Useful to write cross-platform async code! + pub trait MaybeSync: Sync {} + + impl<T> MaybeSync for T where T: Sync {} +} + +#[cfg(target_arch = "wasm32")] +mod platform { + /// An extension trait that enforces `Send` only on native platforms. + /// + /// Useful to write cross-platform async code! + pub trait MaybeSend {} + + impl<T> MaybeSend for T {} + + /// An extension trait that enforces `Send` only on native platforms. + /// + /// Useful to write cross-platform async code! + pub trait MaybeSync {} + + impl<T> MaybeSync for T {} +} + +pub use platform::{MaybeSend, MaybeSync}; |