1#![doc = include_str!("../README.md")]
16#![warn(missing_debug_implementations)]
17
18use std::pin::Pin;
19
20use futures_core::Future;
21#[doc(no_inline)]
22pub use ruma;
23
24pub mod debug;
25pub mod deserialized_responses;
26pub mod executor;
27pub mod failures_cache;
28pub mod linked_chunk;
29pub mod locks;
30pub mod ring_buffer;
31pub mod sleep;
32pub mod store_locks;
33pub mod timeout;
34pub mod tracing_timer;
35pub mod ttl_cache;
36
37#[cfg(all(target_arch = "wasm32", not(tarpaulin_include)))]
41pub mod js_tracing;
42
43pub use store_locks::LEASE_DURATION_MS;
44
45#[cfg(not(target_arch = "wasm32"))]
48pub trait SendOutsideWasm: Send {}
49#[cfg(not(target_arch = "wasm32"))]
50impl<T: Send> SendOutsideWasm for T {}
51
52#[cfg(target_arch = "wasm32")]
55pub trait SendOutsideWasm {}
56#[cfg(target_arch = "wasm32")]
57impl<T> SendOutsideWasm for T {}
58
59#[cfg(not(target_arch = "wasm32"))]
62pub trait SyncOutsideWasm: Sync {}
63#[cfg(not(target_arch = "wasm32"))]
64impl<T: Sync> SyncOutsideWasm for T {}
65
66#[cfg(target_arch = "wasm32")]
69pub trait SyncOutsideWasm {}
70#[cfg(target_arch = "wasm32")]
71impl<T> SyncOutsideWasm for T {}
72
73pub trait AsyncTraitDeps: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm {}
77impl<T: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm> AsyncTraitDeps for T {}
78
79#[macro_export]
81macro_rules! boxed_into_future {
82 () => {
83 $crate::boxed_into_future!(extra_bounds: );
84 };
85 (extra_bounds: $($extra_bounds:tt)*) => {
86 #[cfg(target_arch = "wasm32")]
87 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
88 dyn ::std::future::Future<Output = Self::Output> + $($extra_bounds)*
89 >>;
90 #[cfg(not(target_arch = "wasm32"))]
91 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
92 dyn ::std::future::Future<Output = Self::Output> + Send + $($extra_bounds)*
93 >>;
94 };
95}
96
97#[cfg(target_arch = "wasm32")]
99pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
100#[cfg(not(target_arch = "wasm32"))]
101pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
102
103#[cfg(feature = "uniffi")]
104uniffi::setup_scaffolding!();