synapse_admin_api/
lib.rs

1//! Serializable types for the requests and responses for each endpoint in the
2//! [synapse admin API][api].
3//!
4//! # Compile-time `cfg` settings
5//!
6//! These settings are accepted at compile time to configure the generated code. They can be set as
7//! `--cfg={key}={value}` using `RUSTFLAGS` or `.cargo/config.toml` (under `[build]` -> `rustflags =
8//! ["..."]`).
9//!
10//! * `ruma_identifiers_storage` -- Choose the inner representation of `Owned*` wrapper types for
11//!   identifiers. By default they use [`Box`], setting the value to `Arc` makes them use
12//!   [`Arc`](std::sync::Arc).
13//! * `ruma_unstable_exhaustive_types` -- Most types in synapse-admin-api are marked as
14//!   non-exhaustive to avoid breaking changes when new fields are added in the API. This setting
15//!   compiles all types as exhaustive. By enabling this feature you opt out of all semver
16//!   guarantees synapse-admin-api otherwise provides.
17//!
18//! [api]: https://github.com/matrix-org/synapse/tree/master/docs/admin_api
19
20// FIXME: don't allow dead code, warn on missing docs
21#![allow(dead_code)]
22#![warn(missing_debug_implementations)]
23
24use std::fmt;
25
26pub mod account_validity;
27pub mod background_updates;
28pub mod experimental_features;
29pub mod register_users;
30pub mod room_membership;
31pub mod rooms;
32pub mod users;
33pub mod version;
34
35mod serde;
36
37// Wrapper around `Box<str>` that cannot be used in a meaningful way outside of
38// this crate. Used for string enums because their `_Custom` variant can't be
39// truly private (only `#[doc(hidden)]`).
40#[doc(hidden)]
41#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
42pub struct PrivOwnedStr(Box<str>);
43
44impl fmt::Debug for PrivOwnedStr {
45    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46        self.0.fmt(f)
47    }
48}