From be175bbae6cf727acdc97e9912ee5416bbc3a906 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 25 Jul 2020 02:58:37 +0200 Subject: [PATCH] Mark JoinRulesEventContent as non_exhaustive --- ruma-events/src/room/join_rules.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ruma-events/src/room/join_rules.rs b/ruma-events/src/room/join_rules.rs index d48d7cc0..2fad544e 100644 --- a/ruma-events/src/room/join_rules.rs +++ b/ruma-events/src/room/join_rules.rs @@ -11,6 +11,7 @@ pub type JoinRulesEvent = StateEvent; /// The payload for `JoinRulesEvent`. #[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] +#[non_exhaustive] #[ruma_event(type = "m.room.join_rules")] pub struct JoinRulesEventContent { /// The type of rules used for users wishing to join this room. @@ -18,6 +19,13 @@ pub struct JoinRulesEventContent { pub join_rule: JoinRule, } +impl JoinRulesEventContent { + /// Creates a new `JoinRulesEventContent` with the given rule. + pub fn new(join_rule: JoinRule) -> Self { + Self { join_rule } + } +} + /// The rule used for users wishing to join this room. #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] #[non_exhaustive]