1#![doc = include_str!("../README.md")]
16#![warn(missing_debug_implementations)]
17
18use std::pin::Pin;
19
20#[cfg(test)]
21matrix_sdk_test_utils::init_tracing_for_tests!();
22
23use futures_core::Future;
24#[doc(no_inline)]
25pub use ruma;
26
27pub mod debug;
28pub mod deserialized_responses;
29pub mod executor;
30pub mod failures_cache;
31pub mod linked_chunk;
32pub mod locks;
33pub mod ring_buffer;
34pub mod serde_helpers;
35pub mod sleep;
36pub mod store_locks;
37pub mod stream;
38pub mod timeout;
39pub mod tracing_timer;
40pub mod ttl_cache;
41
42#[cfg(all(target_family = "wasm", not(tarpaulin_include)))]
46pub mod js_tracing;
47
48use ruma::{RoomVersionId, room_version_rules::RoomVersionRules};
49pub use store_locks::LEASE_DURATION_MS;
50
51#[cfg(not(target_family = "wasm"))]
54pub trait SendOutsideWasm: Send {}
55#[cfg(not(target_family = "wasm"))]
56impl<T: Send> SendOutsideWasm for T {}
57
58#[cfg(target_family = "wasm")]
61pub trait SendOutsideWasm {}
62#[cfg(target_family = "wasm")]
63impl<T> SendOutsideWasm for T {}
64
65#[cfg(not(target_family = "wasm"))]
68pub trait SyncOutsideWasm: Sync {}
69#[cfg(not(target_family = "wasm"))]
70impl<T: Sync> SyncOutsideWasm for T {}
71
72#[cfg(target_family = "wasm")]
75pub trait SyncOutsideWasm {}
76#[cfg(target_family = "wasm")]
77impl<T> SyncOutsideWasm for T {}
78
79pub trait AsyncTraitDeps: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm {}
83impl<T: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm> AsyncTraitDeps for T {}
84
85#[macro_export]
87macro_rules! boxed_into_future {
88 () => {
89 $crate::boxed_into_future!(extra_bounds: );
90 };
91 (extra_bounds: $($extra_bounds:tt)*) => {
92 #[cfg(target_family = "wasm")]
93 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
94 dyn ::std::future::Future<Output = Self::Output> + $($extra_bounds)*
95 >>;
96 #[cfg(not(target_family = "wasm"))]
97 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
98 dyn ::std::future::Future<Output = Self::Output> + Send + $($extra_bounds)*
99 >>;
100 };
101}
102
103#[cfg(target_family = "wasm")]
105pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
106#[cfg(not(target_family = "wasm"))]
107pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
108
109#[cfg(feature = "uniffi")]
110uniffi::setup_scaffolding!();
111
112pub const ROOM_VERSION_FALLBACK: RoomVersionId = RoomVersionId::V11;
114
115pub const ROOM_VERSION_RULES_FALLBACK: RoomVersionRules = RoomVersionRules::V11;