Skip to content

Commit 18c08dd

Browse files
author
Patrick Greene
committed
add get_history function to Diagnostic (#2772)
# Objective - Allow access to diagnostic history value. - Fixes #2771. ## Solution - Add Diagnostic::get_history function.
1 parent edd822a commit 18c08dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/bevy_diagnostic/src/diagnostic.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ impl Diagnostic {
119119
pub fn get_max_history_length(&self) -> usize {
120120
self.max_history_length
121121
}
122+
123+
pub fn values(&self) -> impl Iterator<Item = &f64> {
124+
self.history.iter().map(|x| &x.value)
125+
}
126+
127+
pub fn measurements(&self) -> impl Iterator<Item = &DiagnosticMeasurement> {
128+
self.history.iter()
129+
}
122130
}
123131

124132
/// A collection of [Diagnostic]s

0 commit comments

Comments
 (0)