use std::future::Future;
use std::pin::Pin;
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
pub trait MaybeSend: Send {}
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
impl<T: Send> MaybeSend for T {}
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
pub trait MaybeSend {}
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
impl<T> MaybeSend for T {}
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
pub trait MaybeSync: Sync {}
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
impl<T: Sync> MaybeSync for T {}
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
pub trait MaybeSync {}
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
impl<T> MaybeSync for T {}
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
pub type MaybeSendBoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
pub type MaybeSendBoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
pub trait MaybeFutureExt: Future + Sized {
fn maybe_boxed<'a>(self) -> MaybeSendBoxFuture<'a, Self::Output>
where
Self: MaybeSend + 'a,
{
Box::pin(self)
}
}
impl<F: Future> MaybeFutureExt for F {}