macro_rules! dw_code {
(
$(#[$meta:meta])*
$vis:vis const $name:ident : DwCode = DwCode::new($id:literal, ExitTier::$tier:ident)
$(.$chain:ident())? ;
) => { ... };
(
$(#[$meta:meta])*
$vis:vis const $name:ident : &str = $id:literal ;
) => { ... };
}Expand description
Declare a DW code — the only way to. Expands to the constant as written
and registers it in DECLARED:
dw_code! {
/// What the rule refuses.
pub const <NAME>: DwCode = DwCode::new("<code>", ExitTier::<tier>);
}
dw_code! { pub const <NAME>: &str = "<code>"; }The declaration inside the braces is spelled the way
tools/ci/check-dw-codes.py’s CONST_RE reads it, so the source reading
and the binary’s registry are two readings of one text.