diff --git a/ruma-events/src/call/hangup.rs b/ruma-events/src/call/hangup.rs index 4dfe9c7c..0af643f7 100644 --- a/ruma-events/src/call/hangup.rs +++ b/ruma-events/src/call/hangup.rs @@ -32,6 +32,7 @@ pub struct HangupEventContent { /// error in the call negotiation, this should be `ice_failed` for when ICE negotiation fails or /// `invite_timeout` for when the other party did not answer in time. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] +#[non_exhaustive] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum Reason { diff --git a/ruma-events/src/key/verification.rs b/ruma-events/src/key/verification.rs index 888c232c..0da72f61 100644 --- a/ruma-events/src/key/verification.rs +++ b/ruma-events/src/key/verification.rs @@ -14,6 +14,7 @@ pub mod start; /// A hash algorithm. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Serialize, Deserialize)] +#[non_exhaustive] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum HashAlgorithm { @@ -23,6 +24,7 @@ pub enum HashAlgorithm { /// A key agreement protocol. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Serialize, Deserialize)] +#[non_exhaustive] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum KeyAgreementProtocol { @@ -32,6 +34,7 @@ pub enum KeyAgreementProtocol { /// A message authentication code algorithm. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Serialize, Deserialize)] +#[non_exhaustive] #[serde(rename_all = "kebab-case")] #[strum(serialize_all = "kebab-case")] pub enum MessageAuthenticationCode { @@ -41,6 +44,7 @@ pub enum MessageAuthenticationCode { /// A Short Authentication String method. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Serialize, Deserialize)] +#[non_exhaustive] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum ShortAuthenticationString { @@ -53,6 +57,7 @@ pub enum ShortAuthenticationString { /// A Short Authentication String (SAS) verification method. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] +#[non_exhaustive] pub enum VerificationMethod { /// The *m.sas.v1* verification method. #[serde(rename = "m.sas.v1")] diff --git a/ruma-events/src/key/verification/cancel.rs b/ruma-events/src/key/verification/cancel.rs index aa2b67c1..63c96486 100644 --- a/ruma-events/src/key/verification/cancel.rs +++ b/ruma-events/src/key/verification/cancel.rs @@ -32,6 +32,7 @@ pub struct CancelEventContent { /// /// Custom error codes should use the Java package naming convention. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] #[serde(from = "String", into = "String")] pub enum CancelCode { /// The user cancelled the verification. diff --git a/ruma-events/src/key/verification/start.rs b/ruma-events/src/key/verification/start.rs index be676879..85996b19 100644 --- a/ruma-events/src/key/verification/start.rs +++ b/ruma-events/src/key/verification/start.rs @@ -16,6 +16,7 @@ pub type StartEvent = BasicEvent; /// The payload of an *m.key.verification.start* event. #[derive(Clone, Debug, Deserialize, Serialize, BasicEventContent)] +#[non_exhaustive] #[ruma_event(type = "m.key.verification.start")] #[serde(tag = "method")] pub enum StartEventContent { diff --git a/ruma-events/src/push_rules.rs b/ruma-events/src/push_rules.rs index e02ea141..9c83a903 100644 --- a/ruma-events/src/push_rules.rs +++ b/ruma-events/src/push_rules.rs @@ -111,6 +111,7 @@ pub struct PatternedPushRule { /// A condition that must apply for an associated push rule's action to be taken. #[derive(Clone, Debug, Deserialize, Serialize)] +#[non_exhaustive] #[serde(tag = "kind", rename_all = "snake_case")] pub enum PushCondition { /// This is a glob pattern match on a field of the event. diff --git a/ruma-events/src/room/history_visibility.rs b/ruma-events/src/room/history_visibility.rs index e518f54c..8142266b 100644 --- a/ruma-events/src/room/history_visibility.rs +++ b/ruma-events/src/room/history_visibility.rs @@ -20,6 +20,7 @@ pub struct HistoryVisibilityEventContent { /// Who can see a room's history. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] +#[non_exhaustive] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum HistoryVisibility { diff --git a/ruma-events/src/room/join_rules.rs b/ruma-events/src/room/join_rules.rs index 1df547dd..2a212f20 100644 --- a/ruma-events/src/room/join_rules.rs +++ b/ruma-events/src/room/join_rules.rs @@ -19,6 +19,7 @@ pub struct JoinRulesEventContent { /// The rule used for users wishing to join this room. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] +#[non_exhaustive] #[serde(rename_all = "lowercase")] #[strum(serialize_all = "lowercase")] pub enum JoinRule { diff --git a/ruma-events/src/room/member.rs b/ruma-events/src/room/member.rs index f6993430..abdfd439 100644 --- a/ruma-events/src/room/member.rs +++ b/ruma-events/src/room/member.rs @@ -64,6 +64,7 @@ pub struct MemberEventContent { /// The membership state of a user. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] +#[non_exhaustive] #[serde(rename_all = "lowercase")] #[strum(serialize_all = "lowercase")] pub enum MembershipState { @@ -114,6 +115,7 @@ pub struct SignedContent { /// Translation of the membership change in `m.room.member` event. #[derive(Clone, Copy, Debug, Deserialize, Serialize)] +#[non_exhaustive] pub enum MembershipChange { /// No change. None, diff --git a/ruma-events/src/room/message.rs b/ruma-events/src/room/message.rs index 53475da4..6274f387 100644 --- a/ruma-events/src/room/message.rs +++ b/ruma-events/src/room/message.rs @@ -18,6 +18,7 @@ pub type MessageEvent = OuterMessageEvent; /// The payload for `MessageEvent`. #[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] +#[non_exhaustive] #[ruma_event(type = "m.room.message")] #[serde(tag = "msgtype")] pub enum MessageEventContent { @@ -248,6 +249,7 @@ pub struct ServerNoticeMessageEventContent { /// Types of server notices. #[derive(Clone, Copy, Debug, Deserialize, Serialize)] +#[non_exhaustive] pub enum ServerNoticeType { /// The server has exceeded some limit which requires the server administrator to intervene. #[serde(rename = "m.server_notice.usage_limit_reached")] @@ -256,6 +258,7 @@ pub enum ServerNoticeType { /// Types of usage limits. #[derive(Clone, Copy, Debug, Deserialize, Serialize)] +#[non_exhaustive] #[serde(rename_all = "snake_case")] pub enum LimitType { /// The server's number of active users in the last 30 days has exceeded the maximum. diff --git a/ruma-events/src/room/message/feedback.rs b/ruma-events/src/room/message/feedback.rs index d36a2e97..628cee18 100644 --- a/ruma-events/src/room/message/feedback.rs +++ b/ruma-events/src/room/message/feedback.rs @@ -27,6 +27,7 @@ pub struct FeedbackEventContent { /// A type of feedback. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] +#[non_exhaustive] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum FeedbackType { diff --git a/ruma-events/src/room_key_request.rs b/ruma-events/src/room_key_request.rs index b8510965..afd791a6 100644 --- a/ruma-events/src/room_key_request.rs +++ b/ruma-events/src/room_key_request.rs @@ -37,6 +37,7 @@ pub struct RoomKeyRequestEventContent { /// A new key request or a cancellation of a previous request. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] +#[non_exhaustive] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum Action {