#[non_exhaustive]
#[repr(u8)]
pub enum EventCode {
Show 56 variants
EmergencyActionNotification,
NationalInformationCenter,
NationalPeriodicTest,
RequiredMonthlyTest,
RequiredWeeklyTest,
AdministrativeMessage,
AvalancheWatch,
AvalancheWarning,
BlizzardWarning,
BlueAlert,
ChildAbductionEmergency,
CivilDangerWarning,
CivilEmergencyMessage,
CoastalFloodWarning,
CoastalFloodWatch,
DustStormWarning,
EarthquakeWarning,
EvacuationImmediate,
ExtremeWindWarning,
FireWarning,
FlashFloodWarning,
FlashFloodWatch,
FlashFloodStatement,
FloodWarning,
FloodWatch,
FloodStatement,
HazardousMaterialsWarning,
HighWindWarning,
HighWindWatch,
HurricaneWarning,
HurricaneWatch,
HurricaneStatement,
LawEnforcementWarning,
LocalAreaEmergency,
NetworkMessageNotification,
TelephoneOutageEmergency,
NuclearPowerPlantWarning,
PracticeDemoWarning,
RadiologicalHazardWarning,
SevereThunderstormWarning,
SevereThunderstormWatch,
SevereWeatherStatement,
ShelterInPlaceWarning,
SpecialMarineWarning,
SpecialWeatherStatement,
StormSurgeWatch,
StormSurgeWarning,
TornadoWarning,
TornadoWatch,
TropicalStormWarning,
TropicalStormWatch,
TsunamiWarning,
TsunamiWatch,
VolcanoWarning,
WinterStormWarning,
WinterStormWatch,
}Expand description
SAME message event code
Usually constructed via MessageHeader::event(). Event codes were obtained from https://docs.fcc.gov/public/attachments/FCC-16-80A1.pdf.
Converting to string via .as_ref() will yield the SAME
event code string. You can also obtain a human-readable message
use sameold::EventCode;
assert_eq!("RWT", (EventCode::RequiredWeeklyTest).as_ref());
assert_eq!("Required Weekly Test", (EventCode::RequiredWeeklyTest).as_display_str());
assert_eq!(
"Required Weekly Test",
format!("{}", EventCode::RequiredWeeklyTest)
);All events are mapped to a significance level. This may be useful when deciding how to handle the event.
let lvl = (EventCode::RequiredWeeklyTest).to_significance_level();
assert_eq!(lvl, SignificanceLevel::Test);Variants (Non-exhaustive)
This enum is marked as non-exhaustive
EmergencyActionNotification
Emergency Action Notification (begins national activation)
NationalInformationCenter
National Information Center (part of national activation)
NationalPeriodicTest
National Periodic Test
RequiredMonthlyTest
Required Monthly Test
RequiredWeeklyTest
Required Weekly Test
AdministrativeMessage
Administrative Message (state/local)
AvalancheWatch
Avalanche Watch
AvalancheWarning
Avalanche Warning
BlizzardWarning
Blizzard Warning
BlueAlert
Blue Alert (state/local)
ChildAbductionEmergency
Child Abduction Emergency (state/local)
CivilDangerWarning
Civil Danger Warning (state/local)
CivilEmergencyMessage
Civil Emergency Message (state/local)
CoastalFloodWarning
Coastal Flood Warning
CoastalFloodWatch
Coastal Flood Warning
DustStormWarning
Dust Storm Warning
EarthquakeWarning
Earthquake Warning
EvacuationImmediate
Evacuation Immediate
ExtremeWindWarning
Extreme Wind Warning
FireWarning
Fire Warning
FlashFloodWarning
Flash Flood Warning
FlashFloodWatch
Flash Flood Watch
FlashFloodStatement
Flash Flood Statement
FloodWarning
Flood Warning
FloodWatch
Flood Watch
FloodStatement
Flood Statement
HazardousMaterialsWarning
Hazardous Materials Warning
HighWindWarning
High Wind Warning
HighWindWatch
High Wind Watch
HurricaneWarning
Hurricane Warning
HurricaneWatch
Hurricane Watch
HurricaneStatement
Hurricane Statement
LawEnforcementWarning
Law Enforcement Warning
LocalAreaEmergency
Local Area Emergency
NetworkMessageNotification
Network Message Notification
TelephoneOutageEmergency
911 Telephone Outage Emergency
NuclearPowerPlantWarning
Nuclear Power Plant Warning
PracticeDemoWarning
Practice/Demo Warning
RadiologicalHazardWarning
Radiological Hazard Warning
SevereThunderstormWarning
Severe Thunderstorm Warning
SevereThunderstormWatch
Severe Thunderstorm Watch
SevereWeatherStatement
Severe Weather Statement
ShelterInPlaceWarning
Shelter In Place Warning
SpecialMarineWarning
Special Marine Warning
SpecialWeatherStatement
Special Weather Statement
StormSurgeWatch
Storm Surge Watch
StormSurgeWarning
Storm Surge Warning
TornadoWarning
Tornado Warning
TornadoWatch
Tornado Watch
TropicalStormWarning
Tropical Storm Warning
TropicalStormWatch
Tropical Storm Watch
TsunamiWarning
Tsunami Warning
TsunamiWatch
Tsunami Watch
VolcanoWarning
Volcano Warning
WinterStormWarning
Winter Storm Warning
WinterStormWatch
Winter Storm Warning
Implementations
sourceimpl EventCode
impl EventCode
sourcepub fn to_significance_level(&self) -> SignificanceLevel
pub fn to_significance_level(&self) -> SignificanceLevel
Obtain event’s significance level
The significance level ranges from “Test”
(i.e., “this is only a test”) to “Warning.” Each
event code has a significance level associated with
it. The SignificanceLevel
is useful for determining whether an event merits a
“noisy” and/or “immediate” alert for the message.
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 “Required Monthly Test.”
Trait Implementations
sourceimpl EnumMessage for EventCode
impl EnumMessage for EventCode
fn get_message(&self) -> Option<&'static str>
fn get_detailed_message(&self) -> Option<&'static str>
fn get_serializations(&self) -> &'static [&'static str]
sourceimpl EnumProperty for EventCode
impl EnumProperty for EventCode
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 IntoEnumIterator for EventCode
impl IntoEnumIterator for EventCode
type Iterator = EventCodeIter
fn iter() -> EventCodeIterⓘNotable traits for EventCodeIterimpl Iterator for EventCodeIter type Item = EventCode;
sourceimpl TryFrom<&'_ str> for EventCode
impl TryFrom<&'_ str> for EventCode
sourcefn try_from(inp: &str) -> Result<Self, Self::Error>
fn try_from(inp: &str) -> Result<Self, Self::Error>
Convert from three-character SAME event code
Converts an event code like “SVR” into its enumerated
type (EventCode::SevereThunderstormWarning).
If the code is unrecognized, an error is returned.
An error here does NOT mean that the message is
invalid or should be discarded. Instead, if the
error is
WithSignificance,
then you should treat it as a valid (but unknown)
message at the given significance level. This will help
your application react correctly if new codes are
added in the future.
type Error = UnrecognizedEventCode
type Error = UnrecognizedEventCode
The type returned in the event of a conversion error.
impl Copy for EventCode
impl Eq for EventCode
impl StructuralEq for EventCode
impl StructuralPartialEq for EventCode
Auto Trait Implementations
impl RefUnwindSafe for EventCode
impl Send for EventCode
impl Sync for EventCode
impl Unpin for EventCode
impl UnwindSafe for EventCode
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.