Trait HyperlightMetricEnumTest

Source
pub trait HyperlightMetricEnumTest<T>:
    HyperlightMetricEnum<T>
    + From<T>
    + Into<&'static str>
where &'static str: From<Self> + for<'a> From<&'a Self>,
{ // Required method fn get_enum_variant_names() -> &'static [&'static str]; // Provided methods fn enum_has_variant_for_all_metrics() { ... } fn check_metric_definitions() { ... } fn get_intguage_metric(name: &str) -> Result<&IntGauge> { ... } fn get_intcountervec_metric(name: &str) -> Result<&IntCounterVec> { ... } fn get_intcounter_metric(name: &str) -> Result<&IntCounter> { ... } fn get_histogramvec_metric(name: &str) -> Result<&HistogramVec> { ... } }
Expand description

A trait that provides test helper functions for Hyperlight Metrics

Required Methods§

Source

fn get_enum_variant_names() -> &'static [&'static str]

Defines a function that should return the names of all the metric enum variants

Provided Methods§

Source

fn enum_has_variant_for_all_metrics()

Provides a function to test that all hyperlight metric definitions in a module have a corresponding enum variant Should be called in tests in modules that define hyperlight metrics.

Source

fn check_metric_definitions()

Provides a function to test that all hyperlight metric definitions have a unique help text and that there are the same number of enum variants as metric definitions Should be called in tests in modules that define hyperlight metrics.

Source

fn get_intguage_metric(name: &str) -> Result<&IntGauge>

Gets a named int gauge metric

Source

fn get_intcountervec_metric(name: &str) -> Result<&IntCounterVec>

Gets a named int counter vec metric

Source

fn get_intcounter_metric(name: &str) -> Result<&IntCounter>

Gets a named int counter metric

Source

fn get_histogramvec_metric(name: &str) -> Result<&HistogramVec>

Gets a named histogram vec metric

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§