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 cross_process_lock;
28pub mod debug;
29pub mod deserialized_responses;
30pub mod executor;
31pub mod failures_cache;
32pub mod linked_chunk;
33pub mod locks;
34pub mod ring_buffer;
35pub mod serde_helpers;
36pub mod sleep;
37pub mod stream;
38pub mod task_monitor;
39pub mod timeout;
40pub mod tracing_timer;
41pub mod ttl_cache;
42
43#[cfg(all(target_family = "wasm", not(tarpaulin_include)))]
47pub mod js_tracing;
48
49pub use cross_process_lock::LEASE_DURATION_MS;
50use ruma::{RoomVersionId, room_version_rules::RoomVersionRules};
51
52#[cfg(not(target_family = "wasm"))]
55pub trait SendOutsideWasm: Send {}
56#[cfg(not(target_family = "wasm"))]
57impl<T: Send> SendOutsideWasm for T {}
58
59#[cfg(target_family = "wasm")]
62pub trait SendOutsideWasm {}
63#[cfg(target_family = "wasm")]
64impl<T> SendOutsideWasm for T {}
65
66#[cfg(not(target_family = "wasm"))]
69pub trait SyncOutsideWasm: Sync {}
70#[cfg(not(target_family = "wasm"))]
71impl<T: Sync> SyncOutsideWasm for T {}
72
73#[cfg(target_family = "wasm")]
76pub trait SyncOutsideWasm {}
77#[cfg(target_family = "wasm")]
78impl<T> SyncOutsideWasm for T {}
79
80pub trait AsyncTraitDeps: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm {}
84impl<T: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm> AsyncTraitDeps for T {}
85
86#[macro_export]
88macro_rules! boxed_into_future {
89 () => {
90 $crate::boxed_into_future!(extra_bounds: );
91 };
92 (extra_bounds: $($extra_bounds:tt)*) => {
93 #[cfg(target_family = "wasm")]
94 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
95 dyn ::std::future::Future<Output = Self::Output> + $($extra_bounds)*
96 >>;
97 #[cfg(not(target_family = "wasm"))]
98 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
99 dyn ::std::future::Future<Output = Self::Output> + Send + $($extra_bounds)*
100 >>;
101 };
102}
103
104#[cfg(target_family = "wasm")]
106pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
107#[cfg(not(target_family = "wasm"))]
108pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
109
110#[cfg(feature = "uniffi")]
111uniffi::setup_scaffolding!();
112
113pub const ROOM_VERSION_FALLBACK: RoomVersionId = RoomVersionId::V11;
115
116pub const ROOM_VERSION_RULES_FALLBACK: RoomVersionRules = RoomVersionRules::V11;