Skip to content
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

Add field accessor code-gen for the event_enum! macro #97

Merged
merged 4 commits into from
Jun 30, 2020

Conversation

DevinR528
Copy link
Member

There are 9 events kinds so I could switch the if/else blocks of anyone that has more than 4 ||? that may shorten it some. Not sure what the best way to go about this is.

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

Yeah, this is too much boilerplate as you noticed yourself. I've got some ideas how to fix that.

ruma-events-macros/src/event_enum.rs Outdated Show resolved Hide resolved
ruma-events-macros/src/event_enum.rs Outdated Show resolved Hide resolved
ruma-events-macros/src/event_enum.rs Outdated Show resolved Hide resolved
ruma-events-macros/src/event_enum.rs Outdated Show resolved Hide resolved
ruma-events-macros/src/event_enum.rs Outdated Show resolved Hide resolved
Refactor all accessor method code gen in event_enum! macro. Add const
array of (field_str, has_field_function).
@jplatte jplatte merged commit 41b8bd7 into ruma:master Jun 30, 2020
@DevinR528 DevinR528 deleted the field-access branch June 30, 2020 18:08
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