diff options
Diffstat (limited to 'futures/src/maybe_send.rs')
-rw-r--r-- | futures/src/maybe_send.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/futures/src/maybe_send.rs b/futures/src/maybe_send.rs new file mode 100644 index 00000000..a6670f0e --- /dev/null +++ b/futures/src/maybe_send.rs @@ -0,0 +1,21 @@ +#[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 {} +} + +#[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 {} +} + +pub use platform::MaybeSend; |