pub trait HyperlightMetricEnum<T>:
IntoEnumIterator
+ VariantNames
+ From<T>
+ Into<&'static str>{
// Required methods
fn get_init_metrics() -> &'static Once;
fn get_metrics( ) -> &'static OnceCell<HashMap<&'static str, HyperlightMetric>>;
fn get_metric_definitions() -> &'static [HyperlightMetricDefinition];
// Provided methods
fn get_hyperlight_metric(&self) -> Result<&HyperlightMetric> { ... }
fn get_hash_map( ) -> Result<&'static HashMap<&'static str, HyperlightMetric>> { ... }
}
Expand description
A trait that should be implemented by all enums that represent hyperlight metrics
Required Methods§
Sourcefn get_init_metrics() -> &'static Once
fn get_init_metrics() -> &'static Once
A function that should return a static reference to a Once that is used to guard the initialization of the metrics hashmap.
Sourcefn get_metrics() -> &'static OnceCell<HashMap<&'static str, HyperlightMetric>>
fn get_metrics() -> &'static OnceCell<HashMap<&'static str, HyperlightMetric>>
A function that should return a static reference to a OnceCell that is used to store the metrics hashmap.
Sourcefn get_metric_definitions() -> &'static [HyperlightMetricDefinition]
fn get_metric_definitions() -> &'static [HyperlightMetricDefinition]
A function that should return a static reference to a slice of HyperlightMetricDefinitions that are used to initialize the metrics hashmap.
Provided Methods§
Sourcefn get_hyperlight_metric(&self) -> Result<&HyperlightMetric>
fn get_hyperlight_metric(&self) -> Result<&HyperlightMetric>
Gets a HyperlightMetric from the hashmap using the enum variant name as the key
Sourcefn get_hash_map() -> Result<&'static HashMap<&'static str, HyperlightMetric>>
fn get_hash_map() -> Result<&'static HashMap<&'static str, HyperlightMetric>>
Gets the hashmap using the containing the metrics
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.