macro_rules! timing_entries {
(
$visibility:vis enum $name:ident {
$($entry:ident $(= $value:expr)?),*
$(,)?
}
$counter_visibility:vis static $counters:ident: [$counter_type:ty];
) => { ... };
(
$visibility:vis enum $name:ident {
$($entry:ident $(= $value:expr)?),*
$(,)?
}
) => { ... };
(
@entries
$visibility:vis enum $name:ident {
$($entry:ident $(= $value:expr)?),*
$(,)?
}
) => { ... };
}Expand description
Declares an enum and optionally a static counter collection for timing entries.
The generated enum has ALL, COUNT, and to_str associated items. Adding
static COUNTERS: [Counter]; after the enum generates a [Counter; COUNT] static,
initialized from TimingCounter::INITIAL. This keeps entry names, array length,
and reporting order in one declaration.
Without the static declaration, the macro only generates the enum and its helpers.