-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Conditionally compile
Send
bounds instead of SendWrapper
(
#8)
- Loading branch information
Showing
5 changed files
with
56 additions
and
47 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//! Utilities for conditionally adding `Send` and `Sync` constraints. | ||
/// A conditionally compiled trait indirection for `Send` bounds. | ||
/// This target makes it require `Send`. | ||
#[cfg(not(target_arch = "wasm32"))] | ||
pub trait CondSend: Send {} | ||
|
||
/// A conditionally compiled trait indirection for `Send` bounds. | ||
/// This target makes it not require any marker traits. | ||
#[cfg(target_arch = "wasm32")] | ||
pub trait CondSend {} | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
impl<S> CondSend for S where S: Send {} | ||
|
||
#[cfg(target_arch = "wasm32")] | ||
impl<S> CondSend for S {} | ||
|
||
/// A conditionally compiled trait indirection for `Send + Sync` bounds. | ||
/// This target makes it require `Send + Sync`. | ||
#[cfg(not(target_arch = "wasm32"))] | ||
pub trait CondSync: Send + Sync {} | ||
|
||
/// A conditionally compiled trait indirection for `Send + Sync` bounds. | ||
/// This target makes it not require any marker traits. | ||
#[cfg(target_arch = "wasm32")] | ||
pub trait CondSync {} | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
impl<S> CondSync for S where S: Send + Sync {} | ||
|
||
#[cfg(target_arch = "wasm32")] | ||
impl<S> CondSync for S {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters