Introduce MaybeSend trait in iced_futures
It allows to clean up all the `trait_aliases` modules!
This commit is contained in:
parent
83c649b574
commit
5dab5a327e
6 changed files with 49 additions and 150 deletions
21
futures/src/maybe_send.rs
Normal file
21
futures/src/maybe_send.rs
Normal file
|
|
@ -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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue