common: Make recently-moved types non-exhaustive

This commit is contained in:
Jonas Platte 2020-09-11 21:13:04 +02:00
parent 3d1ab0cd3f
commit eab5368edd
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -214,7 +214,8 @@ impl From<PatternedPushRuleInit> for PatternedPushRule {
} }
/// Information for the pusher implementation itself. /// Information for the pusher implementation itself.
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct PusherData { pub struct PusherData {
/// Required if the pusher's kind is http. The URL to use to send notifications to. /// Required if the pusher's kind is http. The URL to use to send notifications to.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -225,11 +226,19 @@ pub struct PusherData {
pub format: Option<PushFormat>, pub format: Option<PushFormat>,
} }
impl PusherData {
/// Creates an empty `PusherData`.
pub fn new() -> Self {
Default::default()
}
}
/// A special format that the homeserver should use when sending notifications to a Push Gateway. /// A special format that the homeserver should use when sending notifications to a Push Gateway.
/// Currently, only "event_id_only" is supported as of [Push Gateway API r0.1.1][spec]. /// Currently, only "event_id_only" is supported as of [Push Gateway API r0.1.1][spec].
/// ///
/// [spec]: https://matrix.org/docs/spec/push_gateway/r0.1.1#homeserver-behaviour /// [spec]: https://matrix.org/docs/spec/push_gateway/r0.1.1#homeserver-behaviour
#[derive(Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, Serialize, Deserialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum PushFormat { pub enum PushFormat {
/// Require the homeserver to only send a reduced set of fields in the push. /// Require the homeserver to only send a reduced set of fields in the push.