cimpl 0.4.1

Simple C implementations from Rust - FFI utilities and macros for creating safe, ergonomic C bindings
Documentation
// Copyright 2024 Adobe. All rights reserved.
// This file is licensed to you under the Apache License, Version 2.0
// or the MIT license, at your option.

//! Conditional Send/Sync for WASM compatibility.
//! On wasm32 these traits are no-ops so types don't need to implement Send/Sync.

#[cfg(not(target_arch = "wasm32"))]
pub trait MaybeSend: Send {}

#[cfg(target_arch = "wasm32")]
pub trait MaybeSend {}

#[cfg(not(target_arch = "wasm32"))]
impl<T: Send + ?Sized> MaybeSend for T {}

#[cfg(target_arch = "wasm32")]
impl<T: ?Sized> MaybeSend for T {}

#[cfg(not(target_arch = "wasm32"))]
pub trait MaybeSync: Sync {}

#[cfg(target_arch = "wasm32")]
pub trait MaybeSync {}

#[cfg(not(target_arch = "wasm32"))]
impl<T: Sync + ?Sized> MaybeSync for T {}

#[cfg(target_arch = "wasm32")]
impl<T: ?Sized> MaybeSync for T {}