#[cfg(not(target_arch = "wasm32"))]
pub type Arc<T> = std::sync::Arc<T>;
#[cfg(target_arch = "wasm32")]
pub type Arc<T> = std::rc::Rc<T>;
#[cfg(not(target_arch = "wasm32"))]
pub type BoxFuture<'a, T> = futures::future::BoxFuture<'a, T>;
#[cfg(target_arch = "wasm32")]
pub type BoxFuture<'a, T> = futures::future::LocalBoxFuture<'a, T>;
#[cfg(not(target_arch = "wasm32"))]
pub type BoxStream<'a, T> = futures::stream::BoxStream<'a, T>;
#[cfg(target_arch = "wasm32")]
pub type BoxStream<'a, T> = futures::stream::LocalBoxStream<'a, T>;
#[cfg(not(target_arch = "wasm32"))]
pub trait CondSend: Send {}
#[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 {}
#[cfg(not(target_arch = "wasm32"))]
pub trait CondSync: Send + Sync {}
#[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 {}
#[cfg(not(target_arch = "wasm32"))]
pub fn boxed_fut<'a, T>(
fut: impl futures::future::Future<Output = T> + Sized + CondSend + 'a,
) -> BoxFuture<'a, T> {
futures::future::FutureExt::boxed(fut)
}
#[cfg(target_arch = "wasm32")]
pub fn boxed_fut<'a, T>(
fut: impl futures::future::Future<Output = T> + Sized + CondSend + 'a,
) -> BoxFuture<'a, T> {
futures::future::FutureExt::boxed_local(fut)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn boxed_stream<'a, T>(
stream: impl futures::stream::Stream<Item = T> + Sized + CondSend + 'a,
) -> BoxStream<'a, T> {
futures::stream::StreamExt::boxed(stream)
}
#[cfg(target_arch = "wasm32")]
pub fn boxed_stream<'a, T>(
stream: impl futures::stream::Stream<Item = T> + Sized + CondSend + 'a,
) -> BoxStream<'a, T> {
futures::stream::StreamExt::boxed_local(stream)
}