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:
namemust be a valid nul-terminated string.descriptionmust be either null or a valid nul-terminated string.
Required Associated Constants§
Sourceconst C_DESCRIPTIONS: Self::CDescriptionsArray
const C_DESCRIPTIONS: Self::CDescriptionsArray
Array of C descriptions of the errors indexed by Self::into_u16
Required Associated Types§
Sourcetype CDescriptionsArray: AsRef<[vlib_error_desc_t]>
type CDescriptionsArray: AsRef<[vlib_error_desc_t]>
Array type for Self::C_DESCRIPTIONS
Required Methods§
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.