Move all content declarations to content trait attribute

This commit is contained in:
Devin Ragotzy 2021-05-13 15:36:39 -04:00 committed by Jonas Platte
parent c7c1251f3f
commit 8252a1a32c
42 changed files with 125 additions and 135 deletions

View File

@ -1,7 +1,7 @@
//! Types for the *m.call.answer* event. //! Types for the *m.call.answer* event.
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use super::SessionDescription; use super::SessionDescription;
@ -11,9 +11,9 @@ use crate::MessageEvent;
pub type AnswerEvent = MessageEvent<AnswerEventContent>; pub type AnswerEvent = MessageEvent<AnswerEventContent>;
/// The payload for `AnswerEvent`. /// The payload for `AnswerEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.call.answer")] #[ruma_event(type = "m.call.answer", kind = Message)]
pub struct AnswerEventContent { pub struct AnswerEventContent {
/// The VoIP session description object. The session description type must be *answer*. /// The VoIP session description object. The session description type must be *answer*.
pub answer: SessionDescription, pub answer: SessionDescription,

View File

@ -1,7 +1,7 @@
//! Types for the *m.call.candidates* event. //! Types for the *m.call.candidates* event.
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::MessageEvent; use crate::MessageEvent;
@ -11,8 +11,8 @@ use crate::MessageEvent;
pub type CandidatesEvent = MessageEvent<CandidatesEventContent>; pub type CandidatesEvent = MessageEvent<CandidatesEventContent>;
/// The payload for `CandidatesEvent`. /// The payload for `CandidatesEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.call.candidates")] #[ruma_event(type = "m.call.candidates", kind = Message)]
pub struct CandidatesEventContent { pub struct CandidatesEventContent {
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
pub call_id: String, pub call_id: String,

View File

@ -1,7 +1,7 @@
//! Types for the *m.call.hangup* event. //! Types for the *m.call.hangup* event.
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use ruma_serde::StringEnum; use ruma_serde::StringEnum;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -12,8 +12,8 @@ use crate::MessageEvent;
pub type HangupEvent = MessageEvent<HangupEventContent>; pub type HangupEvent = MessageEvent<HangupEventContent>;
/// The payload for `HangupEvent`. /// The payload for `HangupEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.call.hangup")] #[ruma_event(type = "m.call.hangup", kind = Message)]
pub struct HangupEventContent { pub struct HangupEventContent {
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
pub call_id: String, pub call_id: String,

View File

@ -1,7 +1,7 @@
//! Types for the *m.call.invite* event. //! Types for the *m.call.invite* event.
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use super::SessionDescription; use super::SessionDescription;
@ -11,8 +11,8 @@ use crate::MessageEvent;
pub type InviteEvent = MessageEvent<InviteEventContent>; pub type InviteEvent = MessageEvent<InviteEventContent>;
/// The payload for `InviteEvent`. /// The payload for `InviteEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.call.invite")] #[ruma_event(type = "m.call.invite", kind = Message)]
pub struct InviteEventContent { pub struct InviteEventContent {
/// A unique identifier for the call. /// A unique identifier for the call.
pub call_id: String, pub call_id: String,

View File

@ -3,8 +3,6 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use ruma_events_macros::EventContent; use ruma_events_macros::EventContent;
#[cfg(feature = "unstable-pre-spec")]
use ruma_events_macros::MessageEventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue; use serde_json::Value as JsonValue;
@ -37,8 +35,8 @@ pub struct AcceptToDeviceEventContent {
} }
/// The payload for a in-room `AcceptEvent`. /// The payload for a in-room `AcceptEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.key.verification.accept")] #[ruma_event(type = "m.key.verification.accept", kind = Message)]
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))] #[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
pub struct AcceptEventContent { pub struct AcceptEventContent {

View File

@ -1,8 +1,6 @@
//! Types for the *m.key.verification.cancel* event. //! Types for the *m.key.verification.cancel* event.
use ruma_events_macros::EventContent; use ruma_events_macros::EventContent;
#[cfg(feature = "unstable-pre-spec")]
use ruma_events_macros::MessageEventContent;
use ruma_serde::StringEnum; use ruma_serde::StringEnum;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -33,8 +31,8 @@ pub struct CancelToDeviceEventContent {
} }
/// The payload for an in-room `CancelEvent`. /// The payload for an in-room `CancelEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.key.verification.cancel")] #[ruma_event(type = "m.key.verification.cancel", kind = Message)]
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))] #[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
pub struct CancelEventContent { pub struct CancelEventContent {

View File

@ -1,6 +1,6 @@
//! Types for the *m.key.verification.done* event. //! Types for the *m.key.verification.done* event.
use ruma_events_macros::{EventContent, MessageEventContent}; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use super::Relation; use super::Relation;
@ -21,8 +21,8 @@ pub struct DoneToDeviceEventContent {
} }
/// The payload for a in-room `m.key.verification.done` event. /// The payload for a in-room `m.key.verification.done` event.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.key.verification.done")] #[ruma_event(type = "m.key.verification.done", kind = Message)]
pub struct DoneEventContent { pub struct DoneEventContent {
/// Relation signaling which verification request this event is responding /// Relation signaling which verification request this event is responding
/// to. /// to.

View File

@ -1,8 +1,6 @@
//! Types for the *m.key.verification.key* event. //! Types for the *m.key.verification.key* event.
use ruma_events_macros::EventContent; use ruma_events_macros::EventContent;
#[cfg(feature = "unstable-pre-spec")]
use ruma_events_macros::MessageEventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
@ -29,8 +27,8 @@ pub struct KeyToDeviceEventContent {
} }
/// The payload for in-room `KeyEvent`. /// The payload for in-room `KeyEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.key.verification.key")] #[ruma_event(type = "m.key.verification.key", kind = Message)]
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))] #[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
pub struct KeyEventContent { pub struct KeyEventContent {

View File

@ -3,8 +3,6 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use ruma_events_macros::EventContent; use ruma_events_macros::EventContent;
#[cfg(feature = "unstable-pre-spec")]
use ruma_events_macros::MessageEventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
@ -37,8 +35,8 @@ pub struct MacToDeviceEventContent {
} }
/// The payload for an in-room `MacEvent`. /// The payload for an in-room `MacEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.key.verification.mac")] #[ruma_event(type = "m.key.verification.mac", kind = Message)]
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))] #[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
pub struct MacEventContent { pub struct MacEventContent {

View File

@ -1,6 +1,6 @@
//! Types for the *m.key.verification.ready* event. //! Types for the *m.key.verification.ready* event.
use ruma_events_macros::{EventContent, MessageEventContent}; use ruma_events_macros::EventContent;
use ruma_identifiers::DeviceIdBox; use ruma_identifiers::DeviceIdBox;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -29,8 +29,8 @@ pub struct ReadyToDeviceEventContent {
} }
/// The payload for an in-room `m.key.verification.ready` event. /// The payload for an in-room `m.key.verification.ready` event.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.key.verification.ready")] #[ruma_event(type = "m.key.verification.ready", kind = Message)]
pub struct ReadyEventContent { pub struct ReadyEventContent {
/// The device ID which is initiating the request. /// The device ID which is initiating the request.
pub from_device: DeviceIdBox, pub from_device: DeviceIdBox,

View File

@ -3,8 +3,6 @@
use std::{collections::BTreeMap, convert::TryFrom}; use std::{collections::BTreeMap, convert::TryFrom};
use ruma_events_macros::EventContent; use ruma_events_macros::EventContent;
#[cfg(feature = "unstable-pre-spec")]
use ruma_events_macros::MessageEventContent;
use ruma_identifiers::DeviceIdBox; use ruma_identifiers::DeviceIdBox;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue; use serde_json::Value as JsonValue;
@ -43,8 +41,8 @@ pub struct StartToDeviceEventContent {
} }
/// The payload of an in-room *m.key.verification.start* event. /// The payload of an in-room *m.key.verification.start* event.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.key.verification.start")] #[ruma_event(type = "m.key.verification.start", kind = Message)]
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))] #[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
pub struct StartEventContent { pub struct StartEventContent {

View File

@ -1,6 +1,6 @@
//! Types for the *m.policy.rule.room* event. //! Types for the *m.policy.rule.room* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{policy::rule::PolicyRuleEventContent, StateEvent}; use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
@ -9,8 +9,8 @@ use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
pub type RoomEvent = StateEvent<RoomEventContent>; pub type RoomEvent = StateEvent<RoomEventContent>;
/// The payload for `RoomEvent`. /// The payload for `RoomEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.policy.rule.room")] #[ruma_event(type = "m.policy.rule.room", kind = State)]
pub struct RoomEventContent(pub PolicyRuleEventContent); pub struct RoomEventContent(pub PolicyRuleEventContent);
#[cfg(test)] #[cfg(test)]

View File

@ -1,6 +1,6 @@
//! Types for the *m.policy.rule.server* event. //! Types for the *m.policy.rule.server* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{policy::rule::PolicyRuleEventContent, StateEvent}; use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
@ -9,6 +9,6 @@ use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
pub type ServerEvent = StateEvent<ServerEventContent>; pub type ServerEvent = StateEvent<ServerEventContent>;
/// The payload for `ServerEvent`. /// The payload for `ServerEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.policy.rule.server")] #[ruma_event(type = "m.policy.rule.server", kind = State)]
pub struct ServerEventContent(pub PolicyRuleEventContent); pub struct ServerEventContent(pub PolicyRuleEventContent);

View File

@ -1,6 +1,6 @@
//! Types for the *m.policy.rule.user* event. //! Types for the *m.policy.rule.user* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{policy::rule::PolicyRuleEventContent, StateEvent}; use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
@ -9,6 +9,6 @@ use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
pub type UserEvent = StateEvent<UserEventContent>; pub type UserEvent = StateEvent<UserEventContent>;
/// The payload for `UserEvent`. /// The payload for `UserEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.policy.rule.user")] #[ruma_event(type = "m.policy.rule.user", kind = State)]
pub struct UserEventContent(pub PolicyRuleEventContent); pub struct UserEventContent(pub PolicyRuleEventContent);

View File

@ -2,7 +2,7 @@
use std::convert::TryFrom; use std::convert::TryFrom;
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::EventId; use ruma_identifiers::EventId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -15,8 +15,8 @@ use crate::{
pub type ReactionEvent = MessageEvent<ReactionEventContent>; pub type ReactionEvent = MessageEvent<ReactionEventContent>;
/// The payload for a `ReactionEvent`. /// The payload for a `ReactionEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.reaction")] #[ruma_event(type = "m.reaction", kind = Message)]
pub struct ReactionEventContent { pub struct ReactionEventContent {
/// Information about the related event. /// Information about the related event.
#[serde(rename = "m.relates_to")] #[serde(rename = "m.relates_to")]

View File

@ -6,7 +6,7 @@ use std::{
}; };
use ruma_common::{receipt::ReceiptType, MilliSecondsSinceUnixEpoch}; use ruma_common::{receipt::ReceiptType, MilliSecondsSinceUnixEpoch};
use ruma_events_macros::EphemeralRoomEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::{EventId, UserId}; use ruma_identifiers::{EventId, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -19,8 +19,8 @@ pub type ReceiptEvent = EphemeralRoomEvent<ReceiptEventContent>;
/// ///
/// A mapping of event ID to a collection of receipts for this event ID. The event ID is the ID of /// A mapping of event ID to a collection of receipts for this event ID. The event ID is the ID of
/// the event being acknowledged and *not* an ID for the receipt itself. /// the event being acknowledged and *not* an ID for the receipt itself.
#[derive(Clone, Debug, Deserialize, Serialize, EphemeralRoomEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.receipt")] #[ruma_event(type = "m.receipt", kind = EphemeralRoom)]
pub struct ReceiptEventContent(pub BTreeMap<EventId, Receipts>); pub struct ReceiptEventContent(pub BTreeMap<EventId, Receipts>);
impl Deref for ReceiptEventContent { impl Deref for ReceiptEventContent {

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.aliases* event. //! Types for the *m.room.aliases* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::{RoomAliasId, RoomVersionId}; use ruma_identifiers::{RoomAliasId, RoomVersionId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
@ -13,9 +13,9 @@ use crate::{
pub type AliasesEvent = StateEvent<AliasesEventContent>; pub type AliasesEvent = StateEvent<AliasesEventContent>;
/// The payload for `AliasesEvent`. /// The payload for `AliasesEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.aliases", custom_redacted)] #[ruma_event(type = "m.room.aliases", kind = State, custom_redacted)]
pub struct AliasesEventContent { pub struct AliasesEventContent {
/// A list of room aliases. /// A list of room aliases.
pub aliases: Vec<RoomAliasId>, pub aliases: Vec<RoomAliasId>,

View File

@ -1,7 +1,7 @@
//! Types for the *m.room.avatar* event. //! Types for the *m.room.avatar* event.
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::MxcUri; use ruma_identifiers::MxcUri;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -14,10 +14,10 @@ use crate::StateEvent;
pub type AvatarEvent = StateEvent<AvatarEventContent>; pub type AvatarEvent = StateEvent<AvatarEventContent>;
/// The payload for `AvatarEvent`. /// The payload for `AvatarEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[cfg_attr(feature = "unstable-pre-spec", derive(Default))] #[cfg_attr(feature = "unstable-pre-spec", derive(Default))]
#[ruma_event(type = "m.room.avatar")] #[ruma_event(type = "m.room.avatar", kind = State)]
pub struct AvatarEventContent { pub struct AvatarEventContent {
/// Information about the avatar image. /// Information about the avatar image.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.canonical_alias* event. //! Types for the *m.room.canonical_alias* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::RoomAliasId; use ruma_identifiers::RoomAliasId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -10,9 +10,9 @@ use crate::StateEvent;
pub type CanonicalAliasEvent = StateEvent<CanonicalAliasEventContent>; pub type CanonicalAliasEvent = StateEvent<CanonicalAliasEventContent>;
/// The payload for `CanonicalAliasEvent`. /// The payload for `CanonicalAliasEvent`.
#[derive(Clone, Debug, Default, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Default, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.canonical_alias")] #[ruma_event(type = "m.room.canonical_alias", kind = State)]
pub struct CanonicalAliasEventContent { pub struct CanonicalAliasEventContent {
/// The canonical alias. /// The canonical alias.
/// ///

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.create* event. //! Types for the *m.room.create* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::{EventId, RoomId, RoomVersionId, UserId}; use ruma_identifiers::{EventId, RoomId, RoomVersionId, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -11,9 +11,9 @@ use crate::StateEvent;
pub type CreateEvent = StateEvent<CreateEventContent>; pub type CreateEvent = StateEvent<CreateEventContent>;
/// The payload for `CreateEvent`. /// The payload for `CreateEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.create")] #[ruma_event(type = "m.room.create", kind = State)]
pub struct CreateEventContent { pub struct CreateEventContent {
/// The `user_id` of the room creator. This is set by the homeserver. /// The `user_id` of the room creator. This is set by the homeserver.
#[ruma_event(skip_redaction)] #[ruma_event(skip_redaction)]

View File

@ -3,7 +3,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::DeviceIdBox; use ruma_identifiers::DeviceIdBox;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -27,9 +27,9 @@ pub enum EncryptedEventScheme {
} }
/// The content payload for `EncryptedEvent`. /// The content payload for `EncryptedEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.encrypted")] #[ruma_event(type = "m.room.encrypted", kind = Message, kind = ToDevice)]
pub struct EncryptedEventContent { pub struct EncryptedEventContent {
/// Encrypted event content /// Encrypted event content
#[serde(flatten)] #[serde(flatten)]

View File

@ -1,7 +1,7 @@
//! Types for the *m.room.encryption* event. //! Types for the *m.room.encryption* event.
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{EventEncryptionAlgorithm, StateEvent}; use crate::{EventEncryptionAlgorithm, StateEvent};
@ -10,9 +10,9 @@ use crate::{EventEncryptionAlgorithm, StateEvent};
pub type EncryptionEvent = StateEvent<EncryptionEventContent>; pub type EncryptionEvent = StateEvent<EncryptionEventContent>;
/// The payload for `EncryptionEvent`. /// The payload for `EncryptionEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.encryption")] #[ruma_event(type = "m.room.encryption", kind = State)]
pub struct EncryptionEventContent { pub struct EncryptionEventContent {
/// The encryption algorithm to be used to encrypt messages sent in this room. /// The encryption algorithm to be used to encrypt messages sent in this room.
/// ///

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.guest_access* event. //! Types for the *m.room.guest_access* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_serde::StringEnum; use ruma_serde::StringEnum;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -13,9 +13,9 @@ use crate::StateEvent;
pub type GuestAccessEvent = StateEvent<GuestAccessEventContent>; pub type GuestAccessEvent = StateEvent<GuestAccessEventContent>;
/// The payload for `GuestAccessEvent`. /// The payload for `GuestAccessEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.guest_access")] #[ruma_event(type = "m.room.guest_access", kind = State)]
pub struct GuestAccessEventContent { pub struct GuestAccessEventContent {
/// A policy for guest user access to a room. /// A policy for guest user access to a room.
pub guest_access: GuestAccess, pub guest_access: GuestAccess,

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.history_visibility* event. //! Types for the *m.room.history_visibility* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_serde::StringEnum; use ruma_serde::StringEnum;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -11,9 +11,9 @@ use crate::StateEvent;
pub type HistoryVisibilityEvent = StateEvent<HistoryVisibilityEventContent>; pub type HistoryVisibilityEvent = StateEvent<HistoryVisibilityEventContent>;
/// The payload for `HistoryVisibilityEvent`. /// The payload for `HistoryVisibilityEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.history_visibility")] #[ruma_event(type = "m.room.history_visibility", kind = State)]
pub struct HistoryVisibilityEventContent { pub struct HistoryVisibilityEventContent {
/// Who can see the room history. /// Who can see the room history.
#[ruma_event(skip_redaction)] #[ruma_event(skip_redaction)]

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.join_rules* event. //! Types for the *m.room.join_rules* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_serde::StringEnum; use ruma_serde::StringEnum;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -10,9 +10,9 @@ use crate::StateEvent;
pub type JoinRulesEvent = StateEvent<JoinRulesEventContent>; pub type JoinRulesEvent = StateEvent<JoinRulesEventContent>;
/// The payload for `JoinRulesEvent`. /// The payload for `JoinRulesEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.join_rules")] #[ruma_event(type = "m.room.join_rules", kind = State)]
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.
#[ruma_event(skip_redaction)] #[ruma_event(skip_redaction)]

View File

@ -2,7 +2,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::{MxcUri, ServerNameBox, ServerSigningKeyId, UserId}; use ruma_identifiers::{MxcUri, ServerNameBox, ServerSigningKeyId, UserId};
use ruma_serde::StringEnum; use ruma_serde::StringEnum;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -37,8 +37,8 @@ use crate::{StateEvent, StrippedStateEvent, SyncStateEvent};
pub type MemberEvent = StateEvent<MemberEventContent>; pub type MemberEvent = StateEvent<MemberEventContent>;
/// The payload for `MemberEvent`. /// The payload for `MemberEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.room.member")] #[ruma_event(type = "m.room.member", kind = State)]
pub struct MemberEventContent { pub struct MemberEventContent {
/// The avatar URL for this user, if any. This is added by the homeserver. /// The avatar URL for this user, if any. This is added by the homeserver.
/// ///

View File

@ -4,7 +4,7 @@ use std::borrow::Cow;
use indoc::formatdoc; use indoc::formatdoc;
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::MxcUri; use ruma_identifiers::MxcUri;
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
use ruma_identifiers::{DeviceIdBox, UserId}; use ruma_identifiers::{DeviceIdBox, UserId};
@ -32,9 +32,9 @@ type JsonObject = serde_json::Map<String, JsonValue>;
pub type MessageEvent = crate::MessageEvent<MessageEventContent>; pub type MessageEvent = crate::MessageEvent<MessageEventContent>;
/// The payload for `MessageEvent`. /// The payload for `MessageEvent`.
#[derive(Clone, Debug, Serialize, MessageEventContent)] #[derive(Clone, Debug, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.message")] #[ruma_event(type = "m.room.message", kind = Message)]
pub struct MessageEventContent { pub struct MessageEventContent {
/// A key which identifies the type of message being sent. /// A key which identifies the type of message being sent.
/// ///

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.message.feedback* event. //! Types for the *m.room.message.feedback* event.
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::EventId; use ruma_identifiers::EventId;
use ruma_serde::StringEnum; use ruma_serde::StringEnum;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -14,9 +14,9 @@ use crate::MessageEvent;
pub type FeedbackEvent = MessageEvent<FeedbackEventContent>; pub type FeedbackEvent = MessageEvent<FeedbackEventContent>;
/// The payload for `FeedbackEvent`. /// The payload for `FeedbackEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.message.feedback")] #[ruma_event(type = "m.room.message.feedback", kind = Message)]
pub struct FeedbackEventContent { pub struct FeedbackEventContent {
/// The event that this feedback is related to. /// The event that this feedback is related to.
pub target_event_id: EventId, pub target_event_id: EventId,

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.name* event. //! Types for the *m.room.name* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{InvalidInput, StateEvent}; use crate::{InvalidInput, StateEvent};
@ -9,8 +9,8 @@ use crate::{InvalidInput, StateEvent};
pub type NameEvent = StateEvent<NameEventContent>; pub type NameEvent = StateEvent<NameEventContent>;
/// The payload for `NameEvent`. /// The payload for `NameEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.room.name")] #[ruma_event(type = "m.room.name", kind = State)]
pub struct NameEventContent { pub struct NameEventContent {
/// The name of the room. This MUST NOT exceed 255 bytes. /// The name of the room. This MUST NOT exceed 255 bytes.
#[serde(default, deserialize_with = "room_name")] #[serde(default, deserialize_with = "room_name")]

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.pinned_events* event. //! Types for the *m.room.pinned_events* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::EventId; use ruma_identifiers::EventId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -10,9 +10,9 @@ use crate::StateEvent;
pub type PinnedEventsEvent = StateEvent<PinnedEventsEventContent>; pub type PinnedEventsEvent = StateEvent<PinnedEventsEventContent>;
/// The payload for `PinnedEventsEvent`. /// The payload for `PinnedEventsEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.room.pinned_events")] #[ruma_event(type = "m.room.pinned_events", kind = State)]
pub struct PinnedEventsEventContent { pub struct PinnedEventsEventContent {
/// An ordered list of event IDs to pin. /// An ordered list of event IDs to pin.
pub pinned: Vec<EventId>, pub pinned: Vec<EventId>,

View File

@ -4,7 +4,7 @@ use std::collections::BTreeMap;
use js_int::{int, Int}; use js_int::{int, Int};
use ruma_common::power_levels::default_power_level; use ruma_common::power_levels::default_power_level;
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -16,8 +16,8 @@ pub use ruma_common::power_levels::NotificationPowerLevels;
pub type PowerLevelsEvent = StateEvent<PowerLevelsEventContent>; pub type PowerLevelsEvent = StateEvent<PowerLevelsEventContent>;
/// The payload for `PowerLevelsEvent`. /// The payload for `PowerLevelsEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.room.power_levels")] #[ruma_event(type = "m.room.power_levels", kind = State)]
pub struct PowerLevelsEventContent { pub struct PowerLevelsEventContent {
/// The level required to ban a user. /// The level required to ban a user.
/// ///

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.server_acl* event. //! Types for the *m.room.server_acl* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::StateEvent; use crate::StateEvent;
@ -9,8 +9,8 @@ use crate::StateEvent;
pub type ServerAclEvent = StateEvent<ServerAclEventContent>; pub type ServerAclEvent = StateEvent<ServerAclEventContent>;
/// The payload for `ServerAclEvent`. /// The payload for `ServerAclEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.room.server_acl")] #[ruma_event(type = "m.room.server_acl", kind = State)]
pub struct ServerAclEventContent { pub struct ServerAclEventContent {
/// True to allow server names that are IP address literals. False to deny. /// True to allow server names that are IP address literals. False to deny.
/// ///

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.third_party_invite* event. //! Types for the *m.room.third_party_invite* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::StateEvent; use crate::StateEvent;
@ -13,8 +13,8 @@ use crate::StateEvent;
pub type ThirdPartyInviteEvent = StateEvent<ThirdPartyInviteEventContent>; pub type ThirdPartyInviteEvent = StateEvent<ThirdPartyInviteEventContent>;
/// The payload for `ThirdPartyInviteEvent`. /// The payload for `ThirdPartyInviteEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.room.third_party_invite")] #[ruma_event(type = "m.room.third_party_invite", kind = State)]
pub struct ThirdPartyInviteEventContent { pub struct ThirdPartyInviteEventContent {
/// A user-readable string which represents the user who has been invited. /// A user-readable string which represents the user who has been invited.
/// ///

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.tombstone* event. //! Types for the *m.room.tombstone* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::RoomId; use ruma_identifiers::RoomId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -11,8 +11,8 @@ use crate::StateEvent;
pub type TombstoneEvent = StateEvent<TombstoneEventContent>; pub type TombstoneEvent = StateEvent<TombstoneEventContent>;
/// The payload for `TombstoneEvent`. /// The payload for `TombstoneEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.room.tombstone")] #[ruma_event(type = "m.room.tombstone", kind = State)]
pub struct TombstoneEventContent { pub struct TombstoneEventContent {
/// A server-defined message. /// A server-defined message.
/// ///

View File

@ -1,6 +1,6 @@
//! Types for the *m.room.topic* event. //! Types for the *m.room.topic* event.
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::StateEvent; use crate::StateEvent;
@ -9,8 +9,8 @@ use crate::StateEvent;
pub type TopicEvent = StateEvent<TopicEventContent>; pub type TopicEvent = StateEvent<TopicEventContent>;
/// The payload for `TopicEvent`. /// The payload for `TopicEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.room.topic")] #[ruma_event(type = "m.room.topic", kind = State)]
pub struct TopicEventContent { pub struct TopicEventContent {
/// The topic text. /// The topic text.
pub topic: String, pub topic: String,

View File

@ -1,6 +1,6 @@
//! Types for the *m.sticker* event. //! Types for the *m.sticker* event.
use ruma_events_macros::MessageEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::MxcUri; use ruma_identifiers::MxcUri;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -10,9 +10,9 @@ use crate::{room::ImageInfo, MessageEvent};
pub type StickerEvent = MessageEvent<StickerEventContent>; pub type StickerEvent = MessageEvent<StickerEventContent>;
/// The payload for `StickerEvent`. /// The payload for `StickerEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.sticker")] #[ruma_event(type = "m.sticker", kind = Message)]
pub struct StickerEventContent { pub struct StickerEventContent {
/// A textual representation or associated description of the sticker image. This could /// A textual representation or associated description of the sticker image. This could
/// be the alt text of the original image, or a message to accompany and further /// be the alt text of the original image, or a message to accompany and further

View File

@ -1,6 +1,6 @@
//! Types for the *m.typing* event. //! Types for the *m.typing* event.
use ruma_events_macros::EphemeralRoomEventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -10,9 +10,9 @@ use crate::EphemeralRoomEvent;
pub type TypingEvent = EphemeralRoomEvent<TypingEventContent>; pub type TypingEvent = EphemeralRoomEvent<TypingEventContent>;
/// The payload for `TypingEvent`. /// The payload for `TypingEvent`.
#[derive(Clone, Debug, Default, Deserialize, Serialize, EphemeralRoomEventContent)] #[derive(Clone, Debug, Default, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "m.typing")] #[ruma_event(type = "m.typing", kind = EphemeralRoom)]
pub struct TypingEventContent { pub struct TypingEventContent {
/// The list of user IDs typing in this room, if any. /// The list of user IDs typing in this room, if any.
pub user_ids: Vec<UserId>, pub user_ids: Vec<UserId>,

View File

@ -1,8 +1,8 @@
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(type = "m.macro.test")] #[ruma_event(type = "m.macro.test", kind = State)]
pub struct MacroTest { pub struct MacroTest {
pub url: String, pub url: String,
} }

View File

@ -1,7 +1,7 @@
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
pub struct MacroTest { pub struct MacroTest {
pub url: String, pub url: String,
} }

View File

@ -1,7 +1,7 @@
error: no event type attribute found, add `#[ruma_event(type = "any.room.event")]` below the event content derive error: no event type attribute found, add `#[ruma_event(type = "any.room.event", kind = Kind)]` below the event content derive
--> $DIR/02-no-event-type.rs:4:48 --> $DIR/02-no-event-type.rs:4:48
| |
4 | #[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] 4 | #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -1,14 +1,14 @@
use ruma_events_macros::StateEventContent; use ruma_events_macros::EventContent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[not_ruma_event(type = "m.macro.test")] #[not_ruma_event(type = "m.macro.test", kind = State)]
pub struct MacroTest { pub struct MacroTest {
pub test: String, pub test: String,
} }
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[ruma_event(event = "m.macro.test")] #[ruma_event(event = "m.macro.test", kind = State)]
pub struct MoreMacroTest { pub struct MoreMacroTest {
pub test: String, pub test: String,
} }

View File

@ -1,19 +1,19 @@
error: no event type attribute found, add `#[ruma_event(type = "any.room.event")]` below the event content derive error: no event type attribute found, add `#[ruma_event(type = "any.room.event", kind = Kind)]` below the event content derive
--> $DIR/03-invalid-event-type.rs:4:48 --> $DIR/03-invalid-event-type.rs:4:48
| |
4 | #[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] 4 | #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of: `type`, `skip_redaction`, `custom_redacted` error: expected one of: `type`, `kind`, `skip_redaction`, `custom_redacted`
--> $DIR/03-invalid-event-type.rs:11:14 --> $DIR/03-invalid-event-type.rs:11:14
| |
11 | #[ruma_event(event = "m.macro.test")] 11 | #[ruma_event(event = "m.macro.test", kind = State)]
| ^^^^^ | ^^^^^
error: cannot find attribute `not_ruma_event` in this scope error: cannot find attribute `not_ruma_event` in this scope
--> $DIR/03-invalid-event-type.rs:5:3 --> $DIR/03-invalid-event-type.rs:5:3
| |
5 | #[not_ruma_event(type = "m.macro.test")] 5 | #[not_ruma_event(type = "m.macro.test", kind = State)]
| ^^^^^^^^^^^^^^ help: a derive helper attribute with a similar name exists: `ruma_event` | ^^^^^^^^^^^^^^ help: a derive helper attribute with a similar name exists: `ruma_event`