Skip to main content

parse_macro_table

Function parse_macro_table 

Source
fn parse_macro_table(body: &str, file: &str) -> Vec<UnionMember>
Expand description

Reads a macro table that pairs payload types with wire tags, as in TextMessageStart(TextMessageStartEvent) => "TEXT_MESSAGE_START",.

Generating the event enum from such a table is a common way to keep the union, the discriminator enum and the constructors in one place — and it hides every tag from a scanner that only reads enum bodies. Entries are only accepted when a tag literal and a payload type appear together, so unrelated macros carrying SCREAMING_SNAKE strings are not mistaken for event declarations.