Skip to main content

Alert

Enum Alert 

Source
pub enum Alert {
    OutOfRange {
        reading: f32,
    },
    RunningOut {
        samples: u32,
    },
    ChangingFast {
        rate: f32,
    },
}
Expand description

An alert raised when a reading crosses a profile’s safety threshold.

Variants§

§

OutOfRange

A controlled reading drifted outside its safe band.

For a cold-chain fridge this is a spoilage excursion: the cooler may be running, but the contents are no longer within the safe temperature range.

Fields

§reading: f32

The reading that triggered the alert.

§

RunningOut

A falling level will reach its empty mark within this many more samples.

Fields

§samples: u32

The estimated number of samples until the level reaches empty.

§

ChangingFast

A reading is changing faster than its safe rate.

For a river gauge this is a flash-flood warning: the level jumped further in one sample than the profile allows.

Fields

§rate: f32

The change since the previous sample, as a positive number.

Implementations§

Source§

impl Alert

Source

pub fn kind(self) -> &'static str

Returns the name of the condition, without the measurement that triggered it.

The bindings carry an alert as a kind and a value, so this is the same word in every language, which is what lets one reading be logged or compared the same way wherever the node’s code is written.

§Returns

One of "OutOfRange", "RunningOut", or "ChangingFast".

Trait Implementations§

Source§

impl Clone for Alert

Source§

fn clone(&self) -> Alert

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 Copy for Alert

Source§

impl Debug for Alert

Source§

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

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

impl PartialEq for Alert

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Alert

Auto Trait Implementations§

§

impl Freeze for Alert

§

impl RefUnwindSafe for Alert

§

impl Send for Alert

§

impl Sync for Alert

§

impl Unpin for Alert

§

impl UnsafeUnpin for Alert

§

impl UnwindSafe for Alert

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.