Skip to main content

ErrorCounters

Trait ErrorCounters 

Source
pub unsafe trait ErrorCounters {
    type CDescriptionsArray: AsRef<[vlib_error_desc_t]>;

    const C_DESCRIPTIONS: Self::CDescriptionsArray;

    // Required method
    fn into_u16(self) -> u16;
}
Expand description

Trait for defining error counters of a VPP node

Typically this trait is implemented automatically using the vpp_plugin_macros::ErrorCounters derive macro.

§Safety

  • The length of C_DESCRIPTIONS must be greater than the maximum value that into_u16 can return (i.e. if implemented for an enum, it should match number of discriminators, and there are no gaps in the discriminator values).
  • Each entry in C_DESCRIPTIONS:
    • name must be a valid nul-terminated string.
    • description must be either null or a valid nul-terminated string.

Required Associated Constants§

Source

const C_DESCRIPTIONS: Self::CDescriptionsArray

Array of C descriptions of the errors indexed by Self::into_u16

Required Associated Types§

Required Methods§

Source

fn into_u16(self) -> u16

The u16 value of this next node

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§