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§
source§impl 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§
source§impl AsRef<str> for SignificanceLevel
impl AsRef<str> for SignificanceLevel
source§impl Clone for SignificanceLevel
impl Clone for SignificanceLevel
source§fn clone(&self) -> SignificanceLevel
fn clone(&self) -> SignificanceLevel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for SignificanceLevel
impl Debug for SignificanceLevel
source§impl Display for SignificanceLevel
impl Display for SignificanceLevel
source§impl 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]
source§impl From<&EventCode> for SignificanceLevel
impl From<&EventCode> for SignificanceLevel
source§fn from(evt: &EventCode) -> SignificanceLevel
fn from(evt: &EventCode) -> SignificanceLevel
Convert to significance level
source§impl FromStr for SignificanceLevel
impl FromStr for SignificanceLevel
source§impl Hash for SignificanceLevel
impl Hash for SignificanceLevel
source§impl Ord for SignificanceLevel
impl Ord for SignificanceLevel
source§fn cmp(&self, other: &SignificanceLevel) -> Ordering
fn cmp(&self, other: &SignificanceLevel) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<SignificanceLevel> for SignificanceLevel
impl PartialEq<SignificanceLevel> for SignificanceLevel
source§fn eq(&self, other: &SignificanceLevel) -> bool
fn eq(&self, other: &SignificanceLevel) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd<SignificanceLevel> for SignificanceLevel
impl PartialOrd<SignificanceLevel> for SignificanceLevel
source§fn partial_cmp(&self, other: &SignificanceLevel) -> Option<Ordering>
fn partial_cmp(&self, other: &SignificanceLevel) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl TryFrom<&str> for SignificanceLevel
impl TryFrom<&str> for SignificanceLevel
source§fn 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
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§
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.