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;
35
36#[cfg(all(target_arch = "wasm32", not(tarpaulin_include)))]
40pub mod js_tracing;
41
42pub use store_locks::LEASE_DURATION_MS;
43
44#[cfg(not(target_arch = "wasm32"))]
47pub trait SendOutsideWasm: Send {}
48#[cfg(not(target_arch = "wasm32"))]
49impl<T: Send> SendOutsideWasm for T {}
50
51#[cfg(target_arch = "wasm32")]
54pub trait SendOutsideWasm {}
55#[cfg(target_arch = "wasm32")]
56impl<T> SendOutsideWasm for T {}
57
58#[cfg(not(target_arch = "wasm32"))]
61pub trait SyncOutsideWasm: Sync {}
62#[cfg(not(target_arch = "wasm32"))]
63impl<T: Sync> SyncOutsideWasm for T {}
64
65#[cfg(target_arch = "wasm32")]
68pub trait SyncOutsideWasm {}
69#[cfg(target_arch = "wasm32")]
70impl<T> SyncOutsideWasm for T {}
71
72pub trait AsyncTraitDeps: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm {}
76impl<T: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm> AsyncTraitDeps for T {}
77
78#[macro_export]
80macro_rules! boxed_into_future {
81 () => {
82 $crate::boxed_into_future!(extra_bounds: );
83 };
84 (extra_bounds: $($extra_bounds:tt)*) => {
85 #[cfg(target_arch = "wasm32")]
86 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
87 dyn ::std::future::Future<Output = Self::Output> + $($extra_bounds)*
88 >>;
89 #[cfg(not(target_arch = "wasm32"))]
90 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
91 dyn ::std::future::Future<Output = Self::Output> + Send + $($extra_bounds)*
92 >>;
93 };
94}
95
96#[cfg(target_arch = "wasm32")]
98pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
99#[cfg(not(target_arch = "wasm32"))]
100pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
101
102#[cfg(feature = "uniffi")]
103uniffi::setup_scaffolding!();