macro_rules! code_enum {
(
$(#[$meta:meta])*
$name:ident {
$($(#[$vmeta:meta])* $code:literal => $variant:ident),* $(,)?
}
) => { ... };
}Expand description
Define an X12 code-list data element as an enum.
Generates the enum (one variant per code plus an Unknown(String) catch-all so
unknown/future codes still round-trip), its Display (variant -> code string),
X12Element parsing (code string -> variant), and serde (as the code string, so
JSON stays a plain string). The variant identifiers are supplied explicitly
because many X12 codes are not valid Rust identifiers (e.g. ā9Lā, āC1ā).
At full scale (element 737 has 196 codes, 738 ~600, 355 has 844) these invocations are expected to be machine-generated from the code lists.