anyrender/
wasm_send_sync.rs

1//! Traits that imply `Send`/`Sync` only on non-wasm platforms. For interop with wgpu.
2
3use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
4
5/// A raw window handle that is `WasmNotSendSync`. For interop with wgpu.
6pub trait WindowHandle: HasWindowHandle + HasDisplayHandle + WasmNotSendSync {}
7impl<T: HasWindowHandle + HasDisplayHandle + WasmNotSendSync> WindowHandle for T {}
8
9/// Trait that implies `Send` and `Sync` on non-wasm platforms
10pub trait WasmNotSendSync: WasmNotSend + WasmNotSync {}
11impl<T: WasmNotSend + WasmNotSync> WasmNotSendSync for T {}
12
13/// Trait that implies `Send` on non-wasm platforms
14#[cfg(not(target_arch = "wasm32"))]
15pub trait WasmNotSend: Send {}
16#[cfg(not(target_arch = "wasm32"))]
17impl<T: Send> WasmNotSend for T {}
18/// Trait that implies `Send` on non-wasm platforms
19#[cfg(target_arch = "wasm32")]
20pub trait WasmNotSend {}
21#[cfg(target_arch = "wasm32")]
22impl<T> WasmNotSend for T {}
23
24/// Trait that implies `Sync` on non-wasm platforms
25#[cfg(not(target_arch = "wasm32"))]
26pub trait WasmNotSync: Sync {}
27#[cfg(not(target_arch = "wasm32"))]
28impl<T: Sync> WasmNotSync for T {}
29/// Trait that implies `Sync` on non-wasm platforms
30#[cfg(target_arch = "wasm32")]
31pub trait WasmNotSync {}
32#[cfg(target_arch = "wasm32")]
33impl<T> WasmNotSync for T {}