Skip to main content

Alert

Enum Alert 

Source
pub enum Alert {
    OutOfRange {
        reading: f32,
    },
    RunningOut {
        samples: u32,
    },
    ChangingFast {
        rate: f32,
    },
    InvalidReading {
        reading: f32,
    },
    Custom {
        code: &'static str,
        value: 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.

§

InvalidReading

A reading that is not a finite number, such as the NaN a failed probe or a garbled payload produces.

Every built-in kind but a monitor raises it, since a node that goes quiet when its sensor fails looks exactly like one whose readings are fine. The reading changes nothing: a setpoint’s output holds its last state, and a level or a surge carries on from the last good reading.

Fields

§reading: f32

The reading as it arrived.

§

Custom

A condition a policy of your own raised, named by a code it chose.

The code is a fixed identifier the policy’s author picks, such as "FrostRisk", and the value is the measurement behind it. The bindings carry it as they carry the built-in kinds, as the code and a number, so a custom condition reads the same wherever the node’s code is written.

Fields

§code: &'static str

The condition’s name, chosen by the policy that raises it.

§value: f32

The measurement behind the condition.

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", "ChangingFast", or "InvalidReading", or the code a custom alert was raised with.

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

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

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

Inequality operator !=. Read more
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.