Skip to content

Revert " Remove event_enum! and only use event_content_enum" #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 19, 2020

Conversation

DevinR528
Copy link
Member

No description provided.

Move EventDeHelper and from_raw_json_value to lib make pub so event_enum! macro can use them and test.  to_camel_case returns a syn::Result.
@DevinR528 DevinR528 changed the title Revert content Revert " Remove event_enum! and only use event_content_enum" Jun 18, 2020

/// Any message event.
pub type AnyMessageEvent = MessageEvent<AnyMessageEventContent>;

/// Any message event stub (message event without a `room_id`, as returned in `/sync` responses)
pub type AnyMessageEventStub = MessageEventStub<AnyMessageEventContent>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess we do need the marker trait implementations... For now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we planning on removing the Any*EventContent enums? An event that has a prev_content is still possible right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Any*EventContent enums are needed when sending events. I don't think they're needed as the C in GenericEvent<C> though.

@@ -236,3 +236,48 @@ fn deserialize_avatar_without_prev_content() {
&& unsigned.is_empty()
);
}

#[test]
fn deserialize_member_event_membership_hoist_unsigned_prev_content() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question (maybe unclear to me bc. English is not my first language): What does 'hoist' mean here?

Copy link
Member Author

@DevinR528 DevinR528 Jun 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of membership being in the content field it's at the top-level, "lifted" out.

Would deserialize_member_event_with_top_level_membership_field be better since the prev_content part isn't actually important to why it was failing?

Clean up imports and test names for state_event
@jplatte jplatte merged commit 184aafa into ruma:master Jun 19, 2020
@DevinR528 DevinR528 deleted the revert-content branch May 3, 2021 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants