summaryrefslogtreecommitdiffstats
path: root/futures/src/maybe.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--futures/src/maybe.rs (renamed from futures/src/maybe_send.rs)16
1 files changed, 15 insertions, 1 deletions
diff --git a/futures/src/maybe_send.rs b/futures/src/maybe.rs
index a6670f0e..1a0bd1d1 100644
--- a/futures/src/maybe_send.rs
+++ b/futures/src/maybe.rs
@@ -6,6 +6,13 @@ mod platform {
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")]
@@ -16,6 +23,13 @@ mod platform {
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;
+pub use platform::{MaybeSend, MaybeSync};