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
45use ruma::{RoomVersionId, room_version_rules::RoomVersionRules};
46pub use store_locks::LEASE_DURATION_MS;
47
48#[cfg(not(target_family = "wasm"))]
51pub trait SendOutsideWasm: Send {}
52#[cfg(not(target_family = "wasm"))]
53impl<T: Send> SendOutsideWasm for T {}
54
55#[cfg(target_family = "wasm")]
58pub trait SendOutsideWasm {}
59#[cfg(target_family = "wasm")]
60impl<T> SendOutsideWasm for T {}
61
62#[cfg(not(target_family = "wasm"))]
65pub trait SyncOutsideWasm: Sync {}
66#[cfg(not(target_family = "wasm"))]
67impl<T: Sync> SyncOutsideWasm for T {}
68
69#[cfg(target_family = "wasm")]
72pub trait SyncOutsideWasm {}
73#[cfg(target_family = "wasm")]
74impl<T> SyncOutsideWasm for T {}
75
76pub trait AsyncTraitDeps: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm {}
80impl<T: std::fmt::Debug + SendOutsideWasm + SyncOutsideWasm> AsyncTraitDeps for T {}
81
82#[macro_export]
84macro_rules! boxed_into_future {
85 () => {
86 $crate::boxed_into_future!(extra_bounds: );
87 };
88 (extra_bounds: $($extra_bounds:tt)*) => {
89 #[cfg(target_family = "wasm")]
90 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
91 dyn ::std::future::Future<Output = Self::Output> + $($extra_bounds)*
92 >>;
93 #[cfg(not(target_family = "wasm"))]
94 type IntoFuture = ::std::pin::Pin<::std::boxed::Box<
95 dyn ::std::future::Future<Output = Self::Output> + Send + $($extra_bounds)*
96 >>;
97 };
98}
99
100#[cfg(target_family = "wasm")]
102pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
103#[cfg(not(target_family = "wasm"))]
104pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
105
106#[cfg(feature = "uniffi")]
107uniffi::setup_scaffolding!();
108
109pub const ROOM_VERSION_FALLBACK: RoomVersionId = RoomVersionId::V11;
111
112pub const ROOM_VERSION_RULES_FALLBACK: RoomVersionRules = RoomVersionRules::V11;