Skip to main content

SensorSnapshot

Struct SensorSnapshot 

Source
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

Source

pub const fn warming_up() -> Self

A snapshot with nothing measured yet.

Source

pub 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

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

Source§

fn clone(&self) -> SensorSnapshot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SensorSnapshot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SensorSnapshot

Source§

fn eq(&self, other: &SensorSnapshot) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SensorSnapshot

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.