Revert "client-api: Allow testing sync_events structs for exhaustiveness"
This reverts commit c816630058ab625d93ebab294e9e6c02dd9d866c. Checking match exhaustiveness can now be done through the new non_exhaustive_omitted_patterns lint.
This commit is contained in:
parent
9b8e6e8d96
commit
21e4c90cfa
@ -32,18 +32,6 @@ impl Response {
|
|||||||
format!("Data in the response from the `{}` API endpoint.", metadata.name.value());
|
format!("Data in the response from the `{}` API endpoint.", metadata.name.value());
|
||||||
let struct_attributes = &self.attributes;
|
let struct_attributes = &self.attributes;
|
||||||
|
|
||||||
let has_test_exhaustive_field = self
|
|
||||||
.fields
|
|
||||||
.iter()
|
|
||||||
.filter_map(|f| f.ident.as_ref())
|
|
||||||
.any(|ident| ident == "__test_exhaustive");
|
|
||||||
|
|
||||||
let non_exhaustive_attr = if has_test_exhaustive_field {
|
|
||||||
quote! {}
|
|
||||||
} else {
|
|
||||||
quote! { #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] }
|
|
||||||
};
|
|
||||||
|
|
||||||
let response_ident = Ident::new("Response", self.response_kw.span());
|
let response_ident = Ident::new("Response", self.response_kw.span());
|
||||||
let fields = &self.fields;
|
let fields = &self.fields;
|
||||||
quote! {
|
quote! {
|
||||||
@ -55,7 +43,7 @@ impl Response {
|
|||||||
#ruma_serde::Outgoing,
|
#ruma_serde::Outgoing,
|
||||||
#ruma_serde::_FakeDeriveSerde,
|
#ruma_serde::_FakeDeriveSerde,
|
||||||
)]
|
)]
|
||||||
#non_exhaustive_attr
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[incoming_derive(!Deserialize, #ruma_api_macros::_FakeDeriveRumaApi)]
|
#[incoming_derive(!Deserialize, #ruma_api_macros::_FakeDeriveRumaApi)]
|
||||||
#[ruma_api(error_ty = #error_ty)]
|
#[ruma_api(error_ty = #error_ty)]
|
||||||
#( #struct_attributes )*
|
#( #struct_attributes )*
|
||||||
|
@ -13,14 +13,3 @@ pub mod r0;
|
|||||||
pub mod unversioned;
|
pub mod unversioned;
|
||||||
|
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
#[doc(hidden)]
|
|
||||||
pub struct Private {
|
|
||||||
_priv: (),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
fn private() -> Private {
|
|
||||||
Private { _priv: () }
|
|
||||||
}
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
//! [GET /_matrix/client/r0/sync](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-sync)
|
//! [GET /_matrix/client/r0/sync](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-sync)
|
||||||
|
|
||||||
// FIXME: once https://github.com/rust-lang/rust/issues/84332 is resolved
|
|
||||||
// the structs can just be non_exhaustive (remove __test_exhaustive)
|
|
||||||
#![allow(clippy::exhaustive_structs)]
|
|
||||||
|
|
||||||
use std::{collections::BTreeMap, time::Duration};
|
use std::{collections::BTreeMap, time::Duration};
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
@ -97,11 +93,6 @@ ruma_api! {
|
|||||||
/// currently held on the server for a device.
|
/// currently held on the server for a device.
|
||||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
pub device_one_time_keys_count: BTreeMap<DeviceKeyAlgorithm, UInt>,
|
pub device_one_time_keys_count: BTreeMap<DeviceKeyAlgorithm, UInt>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
error: crate::Error
|
||||||
@ -125,8 +116,6 @@ impl Response {
|
|||||||
to_device: Default::default(),
|
to_device: Default::default(),
|
||||||
device_lists: Default::default(),
|
device_lists: Default::default(),
|
||||||
device_one_time_keys_count: BTreeMap::new(),
|
device_one_time_keys_count: BTreeMap::new(),
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,7 +157,8 @@ impl<'a> From<&'a str> for Filter<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Updates to rooms.
|
/// Updates to rooms.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Rooms {
|
pub struct Rooms {
|
||||||
/// The rooms that the user has left or been banned from.
|
/// The rooms that the user has left or been banned from.
|
||||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
@ -187,11 +177,6 @@ pub struct Rooms {
|
|||||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
pub knock: BTreeMap<RoomId, KnockedRoom>,
|
pub knock: BTreeMap<RoomId, KnockedRoom>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Rooms {
|
impl Rooms {
|
||||||
@ -206,22 +191,9 @@ impl Rooms {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Rooms {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
leave: BTreeMap::new(),
|
|
||||||
join: BTreeMap::new(),
|
|
||||||
invite: BTreeMap::new(),
|
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
|
||||||
knock: BTreeMap::new(),
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Historical updates to left rooms.
|
/// Historical updates to left rooms.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct LeftRoom {
|
pub struct LeftRoom {
|
||||||
/// The timeline of messages and state changes in the room up to the point when the user
|
/// The timeline of messages and state changes in the room up to the point when the user
|
||||||
/// left.
|
/// left.
|
||||||
@ -235,11 +207,6 @@ pub struct LeftRoom {
|
|||||||
/// The private data that this user has attached to this room.
|
/// The private data that this user has attached to this room.
|
||||||
#[serde(default, skip_serializing_if = "RoomAccountData::is_empty")]
|
#[serde(default, skip_serializing_if = "RoomAccountData::is_empty")]
|
||||||
pub account_data: RoomAccountData,
|
pub account_data: RoomAccountData,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LeftRoom {
|
impl LeftRoom {
|
||||||
@ -254,20 +221,9 @@ impl LeftRoom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for LeftRoom {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
timeline: Default::default(),
|
|
||||||
state: Default::default(),
|
|
||||||
account_data: Default::default(),
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Updates to joined rooms.
|
/// Updates to joined rooms.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct JoinedRoom {
|
pub struct JoinedRoom {
|
||||||
/// Information about the room which clients may need to correctly render it
|
/// Information about the room which clients may need to correctly render it
|
||||||
/// to users.
|
/// to users.
|
||||||
@ -296,11 +252,6 @@ pub struct JoinedRoom {
|
|||||||
/// room. e.g. typing.
|
/// room. e.g. typing.
|
||||||
#[serde(default, skip_serializing_if = "Ephemeral::is_empty")]
|
#[serde(default, skip_serializing_if = "Ephemeral::is_empty")]
|
||||||
pub ephemeral: Ephemeral,
|
pub ephemeral: Ephemeral,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl JoinedRoom {
|
impl JoinedRoom {
|
||||||
@ -320,21 +271,6 @@ impl JoinedRoom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for JoinedRoom {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
summary: Default::default(),
|
|
||||||
unread_notifications: Default::default(),
|
|
||||||
timeline: Default::default(),
|
|
||||||
state: Default::default(),
|
|
||||||
account_data: Default::default(),
|
|
||||||
ephemeral: Default::default(),
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Updates to knocked rooms.
|
/// Updates to knocked rooms.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
@ -356,7 +292,8 @@ pub struct KnockState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Unread notifications count.
|
/// Unread notifications count.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct UnreadNotificationsCount {
|
pub struct UnreadNotificationsCount {
|
||||||
/// The number of unread notifications for this room with the highlight flag set.
|
/// The number of unread notifications for this room with the highlight flag set.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
@ -365,11 +302,6 @@ pub struct UnreadNotificationsCount {
|
|||||||
/// The total number of unread notifications for this room.
|
/// The total number of unread notifications for this room.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub notification_count: Option<UInt>,
|
pub notification_count: Option<UInt>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnreadNotificationsCount {
|
impl UnreadNotificationsCount {
|
||||||
@ -384,19 +316,9 @@ impl UnreadNotificationsCount {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for UnreadNotificationsCount {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
highlight_count: None,
|
|
||||||
notification_count: None,
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Events in the room.
|
/// Events in the room.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Timeline {
|
pub struct Timeline {
|
||||||
/// True if the number of events returned was limited by the `limit` on the filter.
|
/// True if the number of events returned was limited by the `limit` on the filter.
|
||||||
///
|
///
|
||||||
@ -412,11 +334,6 @@ pub struct Timeline {
|
|||||||
/// A list of events.
|
/// A list of events.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub events: Vec<Raw<AnySyncRoomEvent>>,
|
pub events: Vec<Raw<AnySyncRoomEvent>>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Timeline {
|
impl Timeline {
|
||||||
@ -431,29 +348,13 @@ impl Timeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Timeline {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
limited: false,
|
|
||||||
prev_batch: None,
|
|
||||||
events: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// State events in the room.
|
/// State events in the room.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct State {
|
pub struct State {
|
||||||
/// A list of state events.
|
/// A list of state events.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub events: Vec<Raw<AnySyncStateEvent>>,
|
pub events: Vec<Raw<AnySyncStateEvent>>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
@ -468,27 +369,13 @@ impl State {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for State {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
events: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The global private data created by this user.
|
/// The global private data created by this user.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct GlobalAccountData {
|
pub struct GlobalAccountData {
|
||||||
/// A list of events.
|
/// A list of events.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub events: Vec<Raw<AnyGlobalAccountDataEvent>>,
|
pub events: Vec<Raw<AnyGlobalAccountDataEvent>>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GlobalAccountData {
|
impl GlobalAccountData {
|
||||||
@ -503,27 +390,13 @@ impl GlobalAccountData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for GlobalAccountData {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
events: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The private data that this user has attached to this room.
|
/// The private data that this user has attached to this room.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct RoomAccountData {
|
pub struct RoomAccountData {
|
||||||
/// A list of events.
|
/// A list of events.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub events: Vec<Raw<AnyRoomAccountDataEvent>>,
|
pub events: Vec<Raw<AnyRoomAccountDataEvent>>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RoomAccountData {
|
impl RoomAccountData {
|
||||||
@ -538,27 +411,13 @@ impl RoomAccountData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RoomAccountData {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
events: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Ephemeral events not recorded in the timeline or state of the room.
|
/// Ephemeral events not recorded in the timeline or state of the room.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Ephemeral {
|
pub struct Ephemeral {
|
||||||
/// A list of events.
|
/// A list of events.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub events: Vec<Raw<AnySyncEphemeralRoomEvent>>,
|
pub events: Vec<Raw<AnySyncEphemeralRoomEvent>>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ephemeral {
|
impl Ephemeral {
|
||||||
@ -573,18 +432,9 @@ impl Ephemeral {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Ephemeral {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
events: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Information about room for rendering to clients.
|
/// Information about room for rendering to clients.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct RoomSummary {
|
pub struct RoomSummary {
|
||||||
/// Users which can be used to generate a room name if the room does not have
|
/// Users which can be used to generate a room name if the room does not have
|
||||||
/// one. Required if room name or canonical aliases are not set or empty.
|
/// one. Required if room name or canonical aliases are not set or empty.
|
||||||
@ -602,11 +452,6 @@ pub struct RoomSummary {
|
|||||||
/// omitted.
|
/// omitted.
|
||||||
#[serde(rename = "m.invited_member_count", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "m.invited_member_count", skip_serializing_if = "Option::is_none")]
|
||||||
pub invited_member_count: Option<UInt>,
|
pub invited_member_count: Option<UInt>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RoomSummary {
|
impl RoomSummary {
|
||||||
@ -623,29 +468,13 @@ impl RoomSummary {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RoomSummary {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
heroes: vec![],
|
|
||||||
joined_member_count: None,
|
|
||||||
invited_member_count: None,
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Updates to the rooms that the user has been invited to.
|
/// Updates to the rooms that the user has been invited to.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct InvitedRoom {
|
pub struct InvitedRoom {
|
||||||
/// The state of a room that the user has been invited to.
|
/// The state of a room that the user has been invited to.
|
||||||
#[serde(default, skip_serializing_if = "InviteState::is_empty")]
|
#[serde(default, skip_serializing_if = "InviteState::is_empty")]
|
||||||
pub invite_state: InviteState,
|
pub invite_state: InviteState,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InvitedRoom {
|
impl InvitedRoom {
|
||||||
@ -660,27 +489,13 @@ impl InvitedRoom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for InvitedRoom {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
invite_state: Default::default(),
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The state of a room that the user has been invited to.
|
/// The state of a room that the user has been invited to.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct InviteState {
|
pub struct InviteState {
|
||||||
/// A list of state events.
|
/// A list of state events.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub events: Vec<Raw<AnyStrippedStateEvent>>,
|
pub events: Vec<Raw<AnyStrippedStateEvent>>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InviteState {
|
impl InviteState {
|
||||||
@ -695,27 +510,13 @@ impl InviteState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for InviteState {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
events: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Updates to the presence status of other users.
|
/// Updates to the presence status of other users.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Presence {
|
pub struct Presence {
|
||||||
/// A list of events.
|
/// A list of events.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub events: Vec<Raw<PresenceEvent>>,
|
pub events: Vec<Raw<PresenceEvent>>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Presence {
|
impl Presence {
|
||||||
@ -730,27 +531,13 @@ impl Presence {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Presence {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
events: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Messages sent dirrectly between devices.
|
/// Messages sent dirrectly between devices.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct ToDevice {
|
pub struct ToDevice {
|
||||||
/// A list of to-device events.
|
/// A list of to-device events.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub events: Vec<Raw<AnyToDeviceEvent>>,
|
pub events: Vec<Raw<AnyToDeviceEvent>>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToDevice {
|
impl ToDevice {
|
||||||
@ -765,18 +552,9 @@ impl ToDevice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ToDevice {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
events: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Information on E2E device udpates.
|
/// Information on E2E device udpates.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct DeviceLists {
|
pub struct DeviceLists {
|
||||||
/// List of users who have updated their device identity keys or who now
|
/// List of users who have updated their device identity keys or who now
|
||||||
/// share an encrypted room with the client since the previous sync
|
/// share an encrypted room with the client since the previous sync
|
||||||
@ -787,11 +565,6 @@ pub struct DeviceLists {
|
|||||||
/// response.
|
/// response.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub left: Vec<UserId>,
|
pub left: Vec<UserId>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[serde(skip, default = "crate::private")]
|
|
||||||
pub __test_exhaustive: crate::Private,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceLists {
|
impl DeviceLists {
|
||||||
@ -806,17 +579,6 @@ impl DeviceLists {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DeviceLists {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
changed: vec![],
|
|
||||||
left: vec![],
|
|
||||||
#[cfg(not(feature = "unstable-exhaustive-types"))]
|
|
||||||
__test_exhaustive: crate::private(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use assign::assign;
|
use assign::assign;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user