Skip to main content

StatTrigger

Trait StatTrigger 

Source
pub trait StatTrigger {
    // Required methods
    fn stat_list(&self) -> &[StatDefinitionTagged];
    fn tag_value(
        &self,
        stat_id: &StatDefinitionTagged,
        _tag_name: &'static str,
    ) -> String;

    // Provided methods
    fn condition(&self, _stat_id: &StatDefinitionTagged) -> bool { ... }
    fn change(&self, _stat_id: &StatDefinitionTagged) -> Option<ChangeType> { ... }
    fn bucket_value(&self, _stat_id: &StatDefinitionTagged) -> Option<f64> { ... }
}
Expand description

A trait indicating that this log can be used to trigger a statistics change.

Required Methods§

Source

fn stat_list(&self) -> &[StatDefinitionTagged]

The list of stats that this trigger applies to.

Source

fn tag_value( &self, stat_id: &StatDefinitionTagged, _tag_name: &'static str, ) -> String

Get the associated tag value for this log. The value must be convertible to a string so it can be stored internally.

Provided Methods§

Source

fn condition(&self, _stat_id: &StatDefinitionTagged) -> bool

The condition that must be satisfied for this stat to change

Source

fn change(&self, _stat_id: &StatDefinitionTagged) -> Option<ChangeType>

The details of the change to make for this stat, if condition returned true.

Source

fn bucket_value(&self, _stat_id: &StatDefinitionTagged) -> Option<f64>

The value to be used to sort the statistic into the correct bucket(s).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§