accountdata: add an enum to allow returning both global and room accountdata
This commit is contained in:
parent
1de0f493e8
commit
8dd8aab29d
@ -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<AnyRoomAccountDataEvent>),
|
||||
/// An event for the whole account
|
||||
Global(Raw<AnyGlobalAccountDataEvent>),
|
||||
}
|
||||
|
||||
/// A global account data event.
|
||||
#[derive(Clone, Debug, Event)]
|
||||
pub struct GlobalAccountDataEvent<C: GlobalAccountDataEventContent> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user