diff --git a/src/collections/raw/all.rs b/src/collections/raw/all.rs index f45ee354..857a42c0 100644 --- a/src/collections/raw/all.rs +++ b/src/collections/raw/all.rs @@ -544,126 +544,3 @@ impl<'de> Deserialize<'de> for StateEvent { } } } - -macro_rules! impl_from_t_for_event { - ($ty:ty, $variant:ident) => { - impl From<$ty> for Event { - fn from(event: $ty) -> Self { - Event::$variant(event) - } - } - }; -} - -impl_from_t_for_event!(AnswerEvent, CallAnswer); -impl_from_t_for_event!(CandidatesEvent, CallCandidates); -impl_from_t_for_event!(HangupEvent, CallHangup); -impl_from_t_for_event!(InviteEvent, CallInvite); -impl_from_t_for_event!(DirectEvent, Direct); -impl_from_t_for_event!(DummyEvent, Dummy); -impl_from_t_for_event!(ForwardedRoomKeyEvent, ForwardedRoomKey); -impl_from_t_for_event!(FullyReadEvent, FullyRead); -impl_from_t_for_event!(AcceptEvent, KeyVerificationAccept); -impl_from_t_for_event!(CancelEvent, KeyVerificationCancel); -impl_from_t_for_event!(KeyEvent, KeyVerificationKey); -impl_from_t_for_event!(MacEvent, KeyVerificationMac); -impl_from_t_for_event!(RequestEvent, KeyVerificationRequest); -impl_from_t_for_event!(StartEvent, KeyVerificationStart); -impl_from_t_for_event!(IgnoredUserListEvent, IgnoredUserList); -impl_from_t_for_event!(PresenceEvent, Presence); -impl_from_t_for_event!(PushRulesEvent, PushRules); -impl_from_t_for_event!(ReceiptEvent, Receipt); -impl_from_t_for_event!(AliasesEvent, RoomAliases); -impl_from_t_for_event!(AvatarEvent, RoomAvatar); -impl_from_t_for_event!(CanonicalAliasEvent, RoomCanonicalAlias); -impl_from_t_for_event!(CreateEvent, RoomCreate); -impl_from_t_for_event!(EncryptedEvent, RoomEncrypted); -impl_from_t_for_event!(EncryptionEvent, RoomEncryption); -impl_from_t_for_event!(GuestAccessEvent, RoomGuestAccess); -impl_from_t_for_event!(HistoryVisibilityEvent, RoomHistoryVisibility); -impl_from_t_for_event!(JoinRulesEvent, RoomJoinRules); -impl_from_t_for_event!(MemberEvent, RoomMember); -impl_from_t_for_event!(MessageEvent, RoomMessage); -impl_from_t_for_event!(FeedbackEvent, RoomMessageFeedback); -impl_from_t_for_event!(NameEvent, RoomName); -impl_from_t_for_event!(PinnedEventsEvent, RoomPinnedEvents); -impl_from_t_for_event!(PowerLevelsEvent, RoomPowerLevels); -impl_from_t_for_event!(RedactionEvent, RoomRedaction); -impl_from_t_for_event!(ServerAclEvent, RoomServerAcl); -impl_from_t_for_event!(ThirdPartyInviteEvent, RoomThirdPartyInvite); -impl_from_t_for_event!(TombstoneEvent, RoomTombstone); -impl_from_t_for_event!(TopicEvent, RoomTopic); -impl_from_t_for_event!(RoomKeyEvent, RoomKey); -impl_from_t_for_event!(RoomKeyRequestEvent, RoomKeyRequest); -impl_from_t_for_event!(StickerEvent, Sticker); -impl_from_t_for_event!(TagEvent, Tag); -impl_from_t_for_event!(TypingEvent, Typing); -impl_from_t_for_event!(CustomEvent, Custom); -impl_from_t_for_event!(CustomRoomEvent, CustomRoom); -impl_from_t_for_event!(CustomStateEvent, CustomState); - -macro_rules! impl_from_t_for_room_event { - ($ty:ty, $variant:ident) => { - impl From<$ty> for RoomEvent { - fn from(event: $ty) -> Self { - RoomEvent::$variant(event) - } - } - }; -} - -impl_from_t_for_room_event!(AnswerEvent, CallAnswer); -impl_from_t_for_room_event!(CandidatesEvent, CallCandidates); -impl_from_t_for_room_event!(HangupEvent, CallHangup); -impl_from_t_for_room_event!(InviteEvent, CallInvite); -impl_from_t_for_room_event!(AliasesEvent, RoomAliases); -impl_from_t_for_room_event!(AvatarEvent, RoomAvatar); -impl_from_t_for_room_event!(CanonicalAliasEvent, RoomCanonicalAlias); -impl_from_t_for_room_event!(CreateEvent, RoomCreate); -impl_from_t_for_room_event!(EncryptedEvent, RoomEncrypted); -impl_from_t_for_room_event!(EncryptionEvent, RoomEncryption); -impl_from_t_for_room_event!(GuestAccessEvent, RoomGuestAccess); -impl_from_t_for_room_event!(HistoryVisibilityEvent, RoomHistoryVisibility); -impl_from_t_for_room_event!(JoinRulesEvent, RoomJoinRules); -impl_from_t_for_room_event!(MemberEvent, RoomMember); -impl_from_t_for_room_event!(MessageEvent, RoomMessage); -impl_from_t_for_room_event!(FeedbackEvent, RoomMessageFeedback); -impl_from_t_for_room_event!(NameEvent, RoomName); -impl_from_t_for_room_event!(PinnedEventsEvent, RoomPinnedEvents); -impl_from_t_for_room_event!(PowerLevelsEvent, RoomPowerLevels); -impl_from_t_for_room_event!(RedactionEvent, RoomRedaction); -impl_from_t_for_room_event!(ServerAclEvent, RoomServerAcl); -impl_from_t_for_room_event!(StickerEvent, Sticker); -impl_from_t_for_room_event!(ThirdPartyInviteEvent, RoomThirdPartyInvite); -impl_from_t_for_room_event!(TombstoneEvent, RoomTombstone); -impl_from_t_for_room_event!(TopicEvent, RoomTopic); -impl_from_t_for_room_event!(CustomRoomEvent, CustomRoom); -impl_from_t_for_room_event!(CustomStateEvent, CustomState); - -macro_rules! impl_from_t_for_state_event { - ($ty:ty, $variant:ident) => { - impl From<$ty> for StateEvent { - fn from(event: $ty) -> Self { - StateEvent::$variant(event) - } - } - }; -} - -impl_from_t_for_state_event!(AliasesEvent, RoomAliases); -impl_from_t_for_state_event!(AvatarEvent, RoomAvatar); -impl_from_t_for_state_event!(CanonicalAliasEvent, RoomCanonicalAlias); -impl_from_t_for_state_event!(CreateEvent, RoomCreate); -impl_from_t_for_state_event!(EncryptionEvent, RoomEncryption); -impl_from_t_for_state_event!(GuestAccessEvent, RoomGuestAccess); -impl_from_t_for_state_event!(HistoryVisibilityEvent, RoomHistoryVisibility); -impl_from_t_for_state_event!(JoinRulesEvent, RoomJoinRules); -impl_from_t_for_state_event!(MemberEvent, RoomMember); -impl_from_t_for_state_event!(NameEvent, RoomName); -impl_from_t_for_state_event!(PinnedEventsEvent, RoomPinnedEvents); -impl_from_t_for_state_event!(PowerLevelsEvent, RoomPowerLevels); -impl_from_t_for_state_event!(ServerAclEvent, RoomServerAcl); -impl_from_t_for_state_event!(ThirdPartyInviteEvent, RoomThirdPartyInvite); -impl_from_t_for_state_event!(TombstoneEvent, RoomTombstone); -impl_from_t_for_state_event!(TopicEvent, RoomTopic); -impl_from_t_for_state_event!(CustomStateEvent, CustomState); diff --git a/src/collections/raw/only.rs b/src/collections/raw/only.rs index 2e4b8074..80de2f33 100644 --- a/src/collections/raw/only.rs +++ b/src/collections/raw/only.rs @@ -135,16 +135,6 @@ pub enum RoomEvent { CustomRoom(CustomRoomEvent), } -macro_rules! impl_from_t_for_event { - ($ty:ty, $variant:ident) => { - impl From<$ty> for Event { - fn from(event: $ty) -> Self { - Event::$variant(event) - } - } - }; -} - impl<'de> Deserialize<'de> for Event { fn deserialize(deserializer: D) -> Result where @@ -270,42 +260,3 @@ impl<'de> Deserialize<'de> for RoomEvent { } } } - -impl_from_t_for_event!(DirectEvent, Direct); -impl_from_t_for_event!(DummyEvent, Dummy); -impl_from_t_for_event!(ForwardedRoomKeyEvent, ForwardedRoomKey); -impl_from_t_for_event!(FullyReadEvent, FullyRead); -impl_from_t_for_event!(AcceptEvent, KeyVerificationAccept); -impl_from_t_for_event!(CancelEvent, KeyVerificationCancel); -impl_from_t_for_event!(KeyEvent, KeyVerificationKey); -impl_from_t_for_event!(MacEvent, KeyVerificationMac); -impl_from_t_for_event!(RequestEvent, KeyVerificationRequest); -impl_from_t_for_event!(StartEvent, KeyVerificationStart); -impl_from_t_for_event!(IgnoredUserListEvent, IgnoredUserList); -impl_from_t_for_event!(PresenceEvent, Presence); -impl_from_t_for_event!(PushRulesEvent, PushRules); -impl_from_t_for_event!(ReceiptEvent, Receipt); -impl_from_t_for_event!(TagEvent, Tag); -impl_from_t_for_event!(TypingEvent, Typing); -impl_from_t_for_event!(CustomEvent, Custom); - -macro_rules! impl_from_t_for_room_event { - ($ty:ty, $variant:ident) => { - impl From<$ty> for RoomEvent { - fn from(event: $ty) -> Self { - RoomEvent::$variant(event) - } - } - }; -} - -impl_from_t_for_room_event!(AnswerEvent, CallAnswer); -impl_from_t_for_room_event!(CandidatesEvent, CallCandidates); -impl_from_t_for_room_event!(HangupEvent, CallHangup); -impl_from_t_for_room_event!(InviteEvent, CallInvite); -impl_from_t_for_room_event!(EncryptedEvent, RoomEncrypted); -impl_from_t_for_room_event!(MessageEvent, RoomMessage); -impl_from_t_for_room_event!(FeedbackEvent, RoomMessageFeedback); -impl_from_t_for_room_event!(RedactionEvent, RoomRedaction); -impl_from_t_for_room_event!(StickerEvent, Sticker); -impl_from_t_for_room_event!(CustomRoomEvent, CustomRoom);