From 8bf238697226e827dc983f9d89afbd0e252c5254 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 18 Jan 2024 09:55:27 +0100 Subject: Remove `Compositor` window generic And update `glyphon` and `window_clipboard` --- futures/src/maybe.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 futures/src/maybe.rs (limited to 'futures/src/maybe.rs') 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 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 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 MaybeSend for T {} + + /// An extension trait that enforces `Send` only on native platforms. + /// + /// Useful to write cross-platform async code! + pub trait MaybeSync {} + + impl MaybeSync for T {} +} + +pub use platform::{MaybeSend, MaybeSync}; -- cgit From cba56ea76821a3204923d34c3fe634730a86f22d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 18 Jan 2024 11:02:53 +0100 Subject: Fix typo `Send -> Sync` --- futures/src/maybe.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'futures/src/maybe.rs') diff --git a/futures/src/maybe.rs b/futures/src/maybe.rs index 1a0bd1d1..c564a739 100644 --- a/futures/src/maybe.rs +++ b/futures/src/maybe.rs @@ -24,7 +24,7 @@ mod platform { impl MaybeSend for T {} - /// An extension trait that enforces `Send` only on native platforms. + /// An extension trait that enforces `Sync` only on native platforms. /// /// Useful to write cross-platform async code! pub trait MaybeSync {} -- cgit From bdb8f4966ea75c0147165541771ed3f952ac8d13 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 18 Jan 2024 11:21:41 +0100 Subject: Fix grammar in `iced_futures::maybe` module --- futures/src/maybe.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'futures/src/maybe.rs') diff --git a/futures/src/maybe.rs b/futures/src/maybe.rs index c564a739..c6a507c1 100644 --- a/futures/src/maybe.rs +++ b/futures/src/maybe.rs @@ -2,14 +2,14 @@ mod platform { /// An extension trait that enforces `Send` only on native platforms. /// - /// Useful to write cross-platform async code! + /// Useful for writing cross-platform async code! pub trait MaybeSend: Send {} impl MaybeSend for T where T: Send {} /// An extension trait that enforces `Sync` only on native platforms. /// - /// Useful to write cross-platform async code! + /// Useful for writing cross-platform async code! pub trait MaybeSync: Sync {} impl MaybeSync for T where T: Sync {} @@ -19,14 +19,14 @@ mod platform { mod platform { /// An extension trait that enforces `Send` only on native platforms. /// - /// Useful to write cross-platform async code! + /// Useful for writing cross-platform async code! pub trait MaybeSend {} impl MaybeSend for T {} /// An extension trait that enforces `Sync` only on native platforms. /// - /// Useful to write cross-platform async code! + /// Useful for writing cross-platform async code! pub trait MaybeSync {} impl MaybeSync for T {} -- cgit