pub struct TofAlert<'a> {
pub key: &'a str,
pub descr: &'a str,
pub whattodo: Vec<&'a str>,
pub config: TofAlertConfig,
pub variable: Variable,
pub component: Component,
pub outofbound: OutOfBound,
pub triggered: Option<Instant>,
pub n_paged: u32,
}
Expand description
Alerts are clues to trigger a reaction of an individual, so they are designed for humans, but should be issued by a machine
ISSUES: The design choice of going with a &str here and carry the livetime around is admittedly a bit questionable, especially since we might want to create similar alerts automatically (which I did not think of earlier)
Fields§
§key: &'a str
a unique identifier so that we can look this up in settings
descr: &'a str
description of what had happened
whattodo: Vec<&'a str>
recommended course of action
config: TofAlertConfig
The configurable part of the alerm, subscirbers, bounds and is the alarm armed
variable: Variable
The variable which is an issue, e.g Rate
component: Component
The part of the TofSystem which caused the issue
outofbound: OutOfBound
How did the variable get out-of-bounds? E.g. too high, too low?
triggered: Option<Instant>
When did this issue occur?
n_paged: u32
How often did this alert page?
Implementations§
Source§impl TofAlert<'_>
impl TofAlert<'_>
pub fn acknowledge(&mut self)
pub fn has_triggered(&self) -> bool
pub fn format_page(&self) -> String
pub fn get_text(&self) -> String
pub fn trigger(&mut self, val: f32)
pub fn page(&mut self)
pub fn configure_from_manifest(&mut self, manifest: &TofAlertManifest)
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for TofAlert<'a>
impl<'a> RefUnwindSafe for TofAlert<'a>
impl<'a> Send for TofAlert<'a>
impl<'a> Sync for TofAlert<'a>
impl<'a> Unpin for TofAlert<'a>
impl<'a> UnwindSafe for TofAlert<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
Convert
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
Convert
&self
to an expression for Diesel’s query builder. Read more