summaryrefslogtreecommitdiffstats
path: root/futures/src/maybe.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-01-19 20:28:45 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-19 20:28:45 +0100
commit7ae7fcb89855002519bab752fd3686106ce448db (patch)
treeac717dbd031e243519b446ab45e5008adef4f5dc /futures/src/maybe.rs
parent61e3d8502fec7e83c584218e598fa20c79363be3 (diff)
parent9df7bf8ec30ca76016018bc758b4323760e231b0 (diff)
downloadiced-7ae7fcb89855002519bab752fd3686106ce448db.tar.gz
iced-7ae7fcb89855002519bab752fd3686106ce448db.tar.bz2
iced-7ae7fcb89855002519bab752fd3686106ce448db.zip
Merge pull request #2191 from ids1024/raw-window-handle-0.6
Update `wgpu` to `0.19`, `glyphon` to `0.5`, `softbuffer` to `0.4`, `window-clipboard` to `0.4`, and `raw-window-handle` to `0.6`
Diffstat (limited to 'futures/src/maybe.rs')
-rw-r--r--futures/src/maybe.rs35
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..c6a507c1
--- /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 for writing 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 for writing 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 for writing cross-platform async code!
+ pub trait MaybeSend {}
+
+ impl<T> MaybeSend for T {}
+
+ /// An extension trait that enforces `Sync` only on native platforms.
+ ///
+ /// Useful for writing cross-platform async code!
+ pub trait MaybeSync {}
+
+ impl<T> MaybeSync for T {}
+}
+
+pub use platform::{MaybeSend, MaybeSync};