Skip to main content

ruma_common/
lib.rs

1#![doc(html_favicon_url = "https://ruma.dev/favicon.ico")]
2#![doc(html_logo_url = "https://ruma.dev/images/logo.png")]
3//! Common types for the Ruma crates.
4
5#![recursion_limit = "1024"]
6#![warn(missing_docs)]
7// https://github.com/rust-lang/rust-clippy/issues/9029
8#![allow(clippy::derive_partial_eq_without_eq)]
9#![cfg_attr(docsrs, feature(doc_cfg))]
10
11#[cfg(not(all(feature = "client", feature = "server")))]
12compile_error!(
13    "ruma_common's `client` and `server` Cargo features only exist as a workaround are not meant to be disabled"
14);
15
16#[cfg(all(ruma_identifiers_storage = "ThinArc", not(feature = "triomphe")))]
17compile_error!(
18    "the `ThinArc` value for the `ruma_identifiers_storage` compile-time setting requires ruma-common's `triomphe` cargo feature"
19);
20
21#[cfg(all(ruma_identifiers_storage = "SmallVec", not(feature = "smallvec")))]
22compile_error!(
23    "the `SmallVec` value for the `ruma_identifiers_storage` compile-time setting requires ruma-common's `smallvec` cargo feature"
24);
25
26// Hack to allow both ruma-common itself and external crates (or tests) to use procedural macros
27// that expect `ruma_common` to exist in the prelude.
28extern crate self as ruma_common;
29
30#[cfg(feature = "api")]
31pub mod api;
32pub mod authentication;
33pub mod canonical_json;
34pub mod directory;
35pub mod encryption;
36#[cfg(feature = "api")]
37pub mod http_headers;
38mod identifiers;
39pub mod media;
40mod percent_encode;
41pub mod power_levels;
42pub mod presence;
43mod priv_owned_str;
44pub mod profile;
45pub mod push;
46pub mod room;
47pub mod room_version_rules;
48pub mod serde;
49pub mod third_party_invite;
50pub mod thirdparty;
51mod time;
52pub mod to_device;
53
54pub use self::{
55    canonical_json::{CanonicalJsonError, CanonicalJsonObject, CanonicalJsonValue},
56    identifiers::*,
57    time::{MilliSecondsSinceUnixEpoch, SecondsSinceUnixEpoch},
58};
59
60priv_owned_str!();
61
62/// Re-exports used by macro-generated code.
63///
64/// It is not considered part of this module's public API.
65#[doc(hidden)]
66pub mod exports {
67    #[cfg(feature = "api")]
68    pub use bytes;
69    #[cfg(feature = "api")]
70    pub use http;
71    pub use ruma_macros;
72    pub use serde;
73    pub use serde_html_form;
74    pub use serde_json;
75    #[cfg(feature = "smallvec")]
76    pub use smallvec;
77    #[cfg(feature = "triomphe")]
78    pub use triomphe;
79}