events: Use rename_all for JoinRule variants

This commit is contained in:
Kévin Commaille 2022-06-20 18:52:22 +02:00 committed by Kévin Commaille
parent 28d0d90ab5
commit 478375f1f7

View File

@ -81,35 +81,29 @@ impl SyncRoomJoinRulesEvent {
/// documented variant here, use its string representation, obtained through `.as_str()`. /// documented variant here, use its string representation, obtained through `.as_str()`.
#[derive(Clone, Debug, PartialEq, Eq, Serialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[serde(tag = "join_rule")] #[serde(tag = "join_rule", rename_all = "snake_case")]
pub enum JoinRule { pub enum JoinRule {
/// A user who wishes to join the room must first receive an invite to the room from someone /// A user who wishes to join the room must first receive an invite to the room from someone
/// already inside of the room. /// already inside of the room.
#[serde(rename = "invite")]
Invite, Invite,
/// Users can join the room if they are invited, or they can request an invite to the room. /// Users can join the room if they are invited, or they can request an invite to the room.
/// ///
/// They can be allowed (invited) or denied (kicked/banned) access. /// They can be allowed (invited) or denied (kicked/banned) access.
#[serde(rename = "knock")]
Knock, Knock,
/// Reserved but not yet implemented by the Matrix specification. /// Reserved but not yet implemented by the Matrix specification.
#[serde(rename = "private")]
Private, Private,
/// Users can join the room if they are invited, or if they meet any of the conditions /// Users can join the room if they are invited, or if they meet any of the conditions
/// described in a set of [`AllowRule`]s. /// described in a set of [`AllowRule`]s.
#[serde(rename = "restricted")]
Restricted(Restricted), Restricted(Restricted),
/// Users can join the room if they are invited, or if they meet any of the conditions /// Users can join the room if they are invited, or if they meet any of the conditions
/// described in a set of [`AllowRule`]s, or they can request an invite to the room. /// described in a set of [`AllowRule`]s, or they can request an invite to the room.
#[serde(rename = "knock_restricted")]
KnockRestricted(Restricted), KnockRestricted(Restricted),
/// Anyone can join the room without any prior action. /// Anyone can join the room without any prior action.
#[serde(rename = "public")]
Public, Public,
#[doc(hidden)] #[doc(hidden)]