pub struct SensorSnapshot {
pub temperatures: MetricState<Vec<TemperatureReading>>,
pub battery: MetricState<BatterySnapshot>,
}Expand description
All sensor readings.
Fields§
§temperatures: MetricState<Vec<TemperatureReading>>Temperature sensors.
battery: MetricState<BatterySnapshot>Battery, on systems that have one.
Implementations§
Source§impl SensorSnapshot
impl SensorSnapshot
Sourcepub const fn warming_up() -> Self
pub const fn warming_up() -> Self
A snapshot with nothing measured yet.
Sourcepub fn hottest(&self) -> Option<&TemperatureReading>
👎Deprecated since 1.0.0: filters to freshly measured readings, so it answers None for the retained (Stale) temperature list that is normal at idle — read SensorSnapshot::temperatures through MetricState::displayable instead, which yields the value together with its age
pub fn hottest(&self) -> Option<&TemperatureReading>
filters to freshly measured readings, so it answers None for the retained (Stale) temperature list that is normal at idle — read SensorSnapshot::temperatures through MetricState::displayable instead, which yields the value together with its age
The hottest reading, for the compact overview summary (§7.1).
Deprecated in 1.0.0, and still behaves exactly as it always did. It
returns only a freshly measured reading: it filters to
MetricState::fresh, so a retained (Stale) list answers None here
rather than handing back an aged value with no way to say how old it is.
That filter used to be a safeguard and is now a trap. Sensors are read as
their own group on their own cadence (§8.6): every 30 seconds while nobody
is looking at the Battery screen, which is the state a running monitrs is
in almost all of the time. Between reads the collectors carry the last list
forward as Stale { value, age }, so Stale is the normal shape of
temperatures at idle, not an exception — and a caller that reaches for
this method to show “the hottest temperature” therefore gets None for
most of the run, silently, with nothing in the type to warn it.
Read SensorSnapshot::temperatures through the metric’s own state
instead — MetricState::displayable yields the retained value together
with its age, so a reading that is 28 seconds old can be shown and dated
rather than dropped. temperature_display in
crates/monitrs-tui/src/views/mod.rs is that pattern in full: it takes the
maximum inside states::describe, so the age travels with the figure onto
the screen (temp 62.5C ~00:28) instead of being discarded here.
Nothing in this workspace calls it any more. It is kept because 1.0.0 freezes this crate’s API and removal is a major bump; expect it to go in 2.0.0 at the earliest.
Trait Implementations§
Source§impl Clone for SensorSnapshot
impl Clone for SensorSnapshot
Source§fn clone(&self) -> SensorSnapshot
fn clone(&self) -> SensorSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more