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 serde_helpers;
32pub mod sleep;
33pub mod store_locks;
34pub mod stream;
35pub mod timeout;
36pub mod tracing_timer;
37pub mod ttl_cache;
38
39#[cfg(all(target_family = "wasm", not(tarpaulin_include)))]
43pub mod js_tracing;
44
45pub use store_locks::LEASE_DURATION_MS;
46
47#[cfg(not(target_family = "wasm"))]
50pub trait SendOutsideWasm: Send {}
51#[cfg(not(target_family = "wasm"))]
52impl<T: Send> SendOutsideWasm for T {}
53
54#[cfg(target_family = "wasm")]
57pub trait SendOutsideWasm {}
58#[cfg(target_family = "wasm")]
59impl<T> SendOutsideWasm for T {}
60
61#[cfg(not(target_family = "wasm"))]
64pub trait SyncOutsideWasm: Sync {}
65#[cfg(not(target_family = "wasm"))]
66impl<T: Sync> SyncOutsideWasm for T {}
67
68#[cfg(target_family = "wasm")]
71pub trait SyncOutsideWasm {}
72#[cfg(target_family = "wasm")]
73impl<T> SyncOutsideWasm for T {}
74
75pub trait AsyncTraitDeps: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm {}
79impl<T: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm> AsyncTraitDeps for T {}
80
81#[macro_export]
83macro_rules! boxed_into_future {
84 () => {
85 $crate::boxed_into_future!(extra_bounds: );
86 };
87 (extra_bounds: $($extra_bounds:tt)*) => {
88 #[cfg(target_family = "wasm")]
89 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
90 dyn ::std::future::Future<Output = Self::Output> + $($extra_bounds)*
91 >>;
92 #[cfg(not(target_family = "wasm"))]
93 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
94 dyn ::std::future::Future<Output = Self::Output> + Send + $($extra_bounds)*
95 >>;
96 };
97}
98
99#[cfg(target_family = "wasm")]
101pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
102#[cfg(not(target_family = "wasm"))]
103pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
104
105#[cfg(feature = "uniffi")]
106uniffi::setup_scaffolding!();