diff --git a/crates/ruma-events/src/kinds.rs b/crates/ruma-events/src/kinds.rs index 57dc9a35..47ceff30 100644 --- a/crates/ruma-events/src/kinds.rs +++ b/crates/ruma-events/src/kinds.rs @@ -10,6 +10,8 @@ use ruma_macros::Event; use serde::{ser::SerializeStruct, Deserialize, Deserializer, Serialize}; use serde_json::value::RawValue as RawJsonValue; +use crate::{AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent}; + use super::{ AnyInitialStateEvent, EmptyStateKey, EphemeralRoomEventContent, EventContent, EventContentFromType, GlobalAccountDataEventContent, MessageLikeEventContent, @@ -19,6 +21,26 @@ use super::{ ToDeviceEventContent, }; +/// Enum allowing to use the same structures for global and room account data +#[derive(Debug)] +#[allow(clippy::exhaustive_enums)] +pub enum AnyAccountDataEvent { + /// An event for a specific room + Room(AnyRoomAccountDataEvent), + /// An event for the whole account + Global(AnyGlobalAccountDataEvent), +} + +/// Enum allowing to use the same structures for global and room account data +#[derive(Debug)] +#[allow(clippy::exhaustive_enums)] +pub enum AnyRawAccountDataEvent { + /// An event for a specific room + Room(Raw), + /// An event for the whole account + Global(Raw), +} + /// A global account data event. #[derive(Clone, Debug, Event)] pub struct GlobalAccountDataEvent {