Enum sameold::SignificanceLevel
source · [−]#[repr(u8)]
pub enum SignificanceLevel {
Test,
Message,
Statement,
Emergency,
Watch,
Warning,
}Expand description
SAME message significance level
Usually constructed as part of an EventCode.
See also MessageHeader::event()
Significance levels have a single-character text
representation, like “T” for Test. You can attempt to
convert from string:
use sameold::{SignificanceLevel, UnknownSignificanceLevel};
assert_eq!(SignificanceLevel::Watch, SignificanceLevel::try_from("zzA").unwrap());
assert_eq!(UnknownSignificanceLevel {}, SignificanceLevel::try_from("").unwrap_err());
assert_eq!(SignificanceLevel::Test, SignificanceLevel::try_from("T").unwrap());If a multi-character string is given as input, the last character
will be used. The last byte must be valid UTF-8. In all situations
where a valid SignificanceLevel can’t be constructed, an
error is returned.
Significance levels are Ord. Lower significance levels
represent less urgent messages, such as tests and statements.
Higher significance levels represent more important or urgent
messages which may merit a “noisy” notification.
assert!(SignificanceLevel::Test < SignificanceLevel::Warning);
assert!(SignificanceLevel::Watch < SignificanceLevel::Warning);Variants
Test
Test
A message intended only for testing purposes. “This is only a test.”
Message
Message
A non-emergency message
Statement
Statement
A message containing follow up information to a warning, watch, or emergency (NWSI 10-1712).
Emergency
Emergency
An event that by itself would not kill or injure or do property damage, but indirectly may cause other things to happen that result in a hazard. Example, a major power or telephone loss in a large city alone is not a direct hazard but disruption to other critical services could create a variety of conditions that could directly threaten public safety (NWSI 10-1712).
Watch
Watch
Meets the classification of a warning, but either the onset time, probability of occurrence, or location is uncertain (NWSI 10-1712).
Warning
Warning (the most severe event)
Those events that alone pose a significant threat to public safety and/or property, probability of occurrence and location is high, and the onset time is relatively short (NWSI 10-1712).
Implementations
sourceimpl SignificanceLevel
impl SignificanceLevel
sourcepub fn as_display_str(&self) -> &'static str
pub fn as_display_str(&self) -> &'static str
Human-readable string representation
Converts to a human-readable string, like “Warning.”
Trait Implementations
sourceimpl AsRef<str> for SignificanceLevel
impl AsRef<str> for SignificanceLevel
sourceimpl Clone for SignificanceLevel
impl Clone for SignificanceLevel
sourcefn clone(&self) -> SignificanceLevel
fn clone(&self) -> SignificanceLevel
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for SignificanceLevel
impl Debug for SignificanceLevel
sourceimpl Display for SignificanceLevel
impl Display for SignificanceLevel
sourceimpl EnumMessage for SignificanceLevel
impl EnumMessage for SignificanceLevel
fn get_message(&self) -> Option<&'static str>
fn get_detailed_message(&self) -> Option<&'static str>
fn get_serializations(&self) -> &'static [&'static str]
sourceimpl From<&'_ EventCode> for SignificanceLevel
impl From<&'_ EventCode> for SignificanceLevel
sourcefn from(evt: &EventCode) -> SignificanceLevel
fn from(evt: &EventCode) -> SignificanceLevel
Convert to significance level
sourceimpl FromStr for SignificanceLevel
impl FromStr for SignificanceLevel
type Err = ParseError
type Err = ParseError
The associated error which can be returned from parsing.
sourceimpl Hash for SignificanceLevel
impl Hash for SignificanceLevel
sourceimpl Ord for SignificanceLevel
impl Ord for SignificanceLevel
sourceimpl PartialOrd<SignificanceLevel> for SignificanceLevel
impl PartialOrd<SignificanceLevel> for SignificanceLevel
sourcefn partial_cmp(&self, other: &SignificanceLevel) -> Option<Ordering>
fn partial_cmp(&self, other: &SignificanceLevel) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl TryFrom<&'_ str> for SignificanceLevel
impl TryFrom<&'_ str> for SignificanceLevel
sourcefn try_from(inp: &str) -> Result<Self, Self::Error>
fn try_from(inp: &str) -> Result<Self, Self::Error>
Convert from string representation
Matches a standard-form EAS event code, such as xxT for
Test, and converts it to its enumerated type. If the given
string does not end in a significance level,
UnknownSignificanceLevel is returned.
type Error = UnknownSignificanceLevel
type Error = UnknownSignificanceLevel
The type returned in the event of a conversion error.
impl Copy for SignificanceLevel
impl Eq for SignificanceLevel
impl StructuralEq for SignificanceLevel
impl StructuralPartialEq for SignificanceLevel
Auto Trait Implementations
impl RefUnwindSafe for SignificanceLevel
impl Send for SignificanceLevel
impl Sync for SignificanceLevel
impl Unpin for SignificanceLevel
impl UnwindSafe for SignificanceLevel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self is actually part of its subset T (and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self to the equivalent element of its superset.