Refactor the input parsing of event_enums!#121
Conversation
Rename name -> kind and parse input as EventKind. EventKind will only parse for valid event kinds to guard against bad input.
Replace some const str comparisons with the methods of EnumKind.
|
I'm still kinda hoping to get rid of the string checks in the "helper" functions (like in |
|
I'll check moving |
| } | ||
|
|
||
| const PREV_CONTENT_KIND: &[&str] = &[ANY_STATE_EVENT, ANY_SYNC_STATE_EVENT]; | ||
| fn state_key_kind(name: &EventKind, _var: &EventKindVariation) -> bool { |
There was a problem hiding this comment.
You could inline a bunch of these that are only used once, as closures. (or is there some specific reason you didn't?)
There was a problem hiding this comment.
Size and readability but now I think they may be sort enough. I'll commit what I have then inline them so we have a before and after.
|
Just verified that |
Rename name -> kind and parse input as EventKind. EventKind will only parse for valid event kinds to guard against bad input.