Skip to content

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

Merged
jplatte merged 4 commits into
ruma:masterfrom
DevinR528:field-access
Jun 30, 2020
Merged

Add field accessor code-gen for the event_enum! macro#97
jplatte merged 4 commits into
ruma:masterfrom
DevinR528:field-access

Conversation

@DevinR528
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread ruma-events-macros/src/event_enum.rs Outdated
Comment thread ruma-events-macros/src/event_enum.rs Outdated
Comment thread ruma-events-macros/src/event_enum.rs Outdated
Comment thread ruma-events-macros/src/event_enum.rs Outdated
Comment thread ruma-events-macros/src/event_enum.rs Outdated
Comment thread ruma-events/tests/enums.rs
Refactor all accessor method code gen in event_enum! macro. Add const
array of (field_str, has_field_function).
Comment thread ruma-events-macros/src/event_enum.rs Outdated
@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