Replace the impl_enum! macro, which automatically derives instances of std::fmt::Display and std::string::FromStr, with derive macros from the strum crate (Display and EnumString resp.). Closes #90.
34 lines
1.0 KiB
Rust
34 lines
1.0 KiB
Rust
//! Types for the *m.room.guest_access* event.
|
|
|
|
use ruma_events_macros::ruma_event;
|
|
use serde::{Deserialize, Serialize};
|
|
use strum::{Display, EnumString};
|
|
|
|
ruma_event! {
|
|
/// Controls whether guest users are allowed to join rooms.
|
|
///
|
|
/// This event controls whether guest users are allowed to join rooms. If this event is absent,
|
|
/// servers should act as if it is present and has the value `GuestAccess::Forbidden`.
|
|
GuestAccessEvent {
|
|
kind: StateEvent,
|
|
event_type: "m.room.guest_access",
|
|
content: {
|
|
/// A policy for guest user access to a room.
|
|
pub guest_access: GuestAccess,
|
|
},
|
|
}
|
|
}
|
|
|
|
/// A policy for guest user access to a room.
|
|
#[derive(Clone, Copy, Debug, Display, EnumString, PartialEq, Deserialize, Serialize)]
|
|
#[non_exhaustive]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[strum(serialize_all = "snake_case")]
|
|
pub enum GuestAccess {
|
|
/// Guests are allowed to join the room.
|
|
CanJoin,
|
|
|
|
/// Guests are not allowed to join the room.
|
|
Forbidden,
|
|
}
|