add get_history function to Diagnostic (#2772)

# Objective

- Allow access to diagnostic history value.
- Fixes #2771.

## Solution

- Add Diagnostic::get_history function.
This commit is contained in:
Patrick Greene 2021-09-06 19:16:08 +00:00
parent edd822a2bb
commit 18c08dd860

View file

@ -119,6 +119,14 @@ impl Diagnostic {
pub fn get_max_history_length(&self) -> usize {
self.max_history_length
}
pub fn values(&self) -> impl Iterator<Item = &f64> {
self.history.iter().map(|x| &x.value)
}
pub fn measurements(&self) -> impl Iterator<Item = &DiagnosticMeasurement> {
self.history.iter()
}
}
/// A collection of [Diagnostic]s