Mark JoinRulesEventContent as non_exhaustive

This commit is contained in:
Jonas Platte 2020-07-25 02:58:37 +02:00
parent ea2992a412
commit be175bbae6
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -11,6 +11,7 @@ pub type JoinRulesEvent = StateEvent<JoinRulesEventContent>;
/// The payload for `JoinRulesEvent`. /// The payload for `JoinRulesEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
#[non_exhaustive]
#[ruma_event(type = "m.room.join_rules")] #[ruma_event(type = "m.room.join_rules")]
pub struct JoinRulesEventContent { pub struct JoinRulesEventContent {
/// The type of rules used for users wishing to join this room. /// The type of rules used for users wishing to join this room.
@ -18,6 +19,13 @@ pub struct JoinRulesEventContent {
pub join_rule: JoinRule, 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. /// The rule used for users wishing to join this room.
#[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)]
#[non_exhaustive] #[non_exhaustive]