ErrorCounters

Derive Macro ErrorCounters 

Source
#[derive(ErrorCounters)]
{
    // Attributes available to this derive:
    #[error_counter]
}
Expand description

Derives the ErrorCounters trait for a VPP error counter enum

Only unit variants are allowed and they must not have explicit values.

§Attributes

Each variant must have a #[error_counter(...)] attribute, with the following key-value pairs:

  • name = "<name>": (optional) The name of the error counter. If not provided, the variant name will be used.
  • description = "<description>": (required) A description of the error counter
  • severity = <severity>: (required) The severity of the error counter. Must be one of INFO, WARNING, ERROR, or CRITICAL.

§Examples

#[derive(ErrorCounters)]
enum ExampleErrors {
    #[error_counter(name = "drop", description = "Example drop", severity = ERROR)]
    Drop,
}