Merge JsonObject type aliases
This commit is contained in:
parent
fde518ea89
commit
af250cf108
@ -5,13 +5,12 @@ use std::borrow::Cow;
|
|||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
use ruma_identifiers::MxcUri;
|
use ruma_identifiers::MxcUri;
|
||||||
|
use ruma_serde::JsonObject;
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
use ruma_serde::StringEnum;
|
use ruma_serde::StringEnum;
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
type JsonObject = serde_json::Map<String, JsonValue>;
|
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
metadata: {
|
metadata: {
|
||||||
description: "Gets the homeserver's supported login types to authenticate users. Clients should pick one of these and supply it as the type when logging in.",
|
description: "Gets the homeserver's supported login types to authenticate users. Clients should pick one of these and supply it as the type when logging in.",
|
||||||
|
@ -8,7 +8,7 @@ use ruma_events_macros::EventContent;
|
|||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
use ruma_identifiers::{DeviceIdBox, UserId};
|
use ruma_identifiers::{DeviceIdBox, UserId};
|
||||||
use ruma_identifiers::{EventId, MxcUri};
|
use ruma_identifiers::{EventId, MxcUri};
|
||||||
use ruma_serde::StringEnum;
|
use ruma_serde::{JsonObject, StringEnum};
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
@ -20,8 +20,6 @@ mod content_serde;
|
|||||||
pub mod feedback;
|
pub mod feedback;
|
||||||
mod relation_serde;
|
mod relation_serde;
|
||||||
|
|
||||||
type JsonObject = serde_json::Map<String, JsonValue>;
|
|
||||||
|
|
||||||
/// This event is used when sending messages in a room.
|
/// This event is used when sending messages in a room.
|
||||||
///
|
///
|
||||||
/// Messages are not limited to be text.
|
/// Messages are not limited to be text.
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
mod buf;
|
mod buf;
|
||||||
pub mod can_be_empty;
|
pub mod can_be_empty;
|
||||||
mod canonical_json;
|
mod canonical_json;
|
||||||
@ -32,6 +34,9 @@ pub use strings::{
|
|||||||
none_as_empty_string,
|
none_as_empty_string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// The inner type of [`serde_json::Value:::Object`].
|
||||||
|
pub type JsonObject = serde_json::Map<String, JsonValue>;
|
||||||
|
|
||||||
/// Check whether a value is equal to its default value.
|
/// Check whether a value is equal to its default value.
|
||||||
pub fn is_default<T: Default + PartialEq>(val: &T) -> bool {
|
pub fn is_default<T: Default + PartialEq>(val: &T) -> bool {
|
||||||
*val == T::default()
|
*val == T::default()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user