Skip to main content

Module common

Module common 

Source

Constants§

BANNER_PREFIX
The opening bytes of every file the generator writes.

Functions§

banner
Return the standard AUTO-GENERATED header comment for a generated source file.
format_int_literal
Format an integer string as a Rust literal with underscores every 3 digits from the right. This satisfies clippy::unreadable_literal for large numbers, for example -2_147_483_648i32.
parse_tokens
Lex an emitter-produced Rust fragment into tokens.
statement
expr as a statement: followed by ;, unless it is block-like (if, match, for or a { .. } block), which stands as a statement alone.
tag_literal
The tag of a tagged field, as an unsuffixed literal.
uses_ident
True when tokens holds the identifier name at any depth.
validate
Parse generated tokens as a complete syntax node of type T, to check that an emitter produced valid Rust.