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