pub trait HyperlightMetricEnumTest<T>:
HyperlightMetricEnum<T>
+ From<T>
+ Into<&'static str>{
// 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§
Sourcefn get_enum_variant_names() -> &'static [&'static str]
fn get_enum_variant_names() -> &'static [&'static str]
Defines a function that should return the names of all the metric enum variants
Provided Methods§
Sourcefn enum_has_variant_for_all_metrics()
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.
Sourcefn check_metric_definitions()
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.
Sourcefn get_intguage_metric(name: &str) -> Result<&IntGauge>
fn get_intguage_metric(name: &str) -> Result<&IntGauge>
Gets a named int gauge metric
Sourcefn get_intcountervec_metric(name: &str) -> Result<&IntCounterVec>
fn get_intcountervec_metric(name: &str) -> Result<&IntCounterVec>
Gets a named int counter vec metric
Sourcefn get_intcounter_metric(name: &str) -> Result<&IntCounter>
fn get_intcounter_metric(name: &str) -> Result<&IntCounter>
Gets a named int counter metric
Sourcefn get_histogramvec_metric(name: &str) -> Result<&HistogramVec>
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.