#[non_exhaustive]pub enum Phenomenon {
Show 48 variants
NationalEmergency,
NationalInformationCenter,
NationalAudibleTest,
NationalPeriodicTest,
NationalSilentTest,
RequiredMonthlyTest,
RequiredWeeklyTest,
AdministrativeMessage,
Avalanche,
Blizzard,
BlueAlert,
ChildAbduction,
CivilDanger,
CivilEmergency,
CoastalFlood,
DustStorm,
Earthquake,
Evacuation,
ExtremeWind,
Fire,
FlashFlood,
FlashFreeze,
Flood,
Freeze,
HazardousMaterials,
HighWind,
Hurricane,
HurricaneLocalStatement,
LawEnforcementWarning,
LocalAreaEmergency,
NetworkMessageNotification,
TelephoneOutage,
NuclearPowerPlant,
PracticeDemoWarning,
RadiologicalHazard,
SevereThunderstorm,
SevereWeather,
ShelterInPlace,
SnowSquall,
SpecialMarine,
SpecialWeatherStatement,
StormSurge,
Tornado,
TropicalStorm,
Tsunami,
Volcano,
WinterStorm,
Unrecognized,
}Expand description
SAME message phenomenon
A Phenomenon code indicates what prompted the message. These include
tests, such as the
required weekly test,
and live messages like floods. Some events
have multiple significance levels: floods can be reported as both
a “Flood Watch” and a “Flood Warning.” The Phenomenon only encodes
Phenomenon::Flood—the significance
is left to other types.
Phenomenon may be matched individually if the user wishes to take special action…
match phenomenon {
Phenomenon::Flood => println!("this message describes a flood"),
_ => { /* pass */ }
}… but the programmer must exercise caution here. Flooding may also
result from a Phenomenon::FlashFlood or a larger event like a
Phenomenon::Hurricane. An evacuation might be declared with
Phenomenon::Evacuation, but many other messages might prompt an
evacuation as part of the response. So:
⚠️ When in doubt, play the message and let the user decide! ⚠️
sameplace does separate Phenomenon into broad categories. These include:
assert!(Phenomenon::NationalPeriodicTest.is_national());
assert!(Phenomenon::NationalPeriodicTest.is_test());
assert!(Phenomenon::SevereThunderstorm.is_weather());
assert!(Phenomenon::Fire.is_non_weather());All Phenomenon Display a human-readable description of the event,
without its significance level.
use std::fmt;
assert_eq!(format!("{}", Phenomenon::HazardousMaterials), "Hazardous Materials");
assert_eq!(Phenomenon::HazardousMaterials.as_brief_str(), "Hazardous Materials");but you probably want to display the full
EventCode instead.
NOTE: the strum traits on this type are not considered API.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NationalEmergency
National Emergency Message
This was previously known as Emergency Action Notification
NationalInformationCenter
National Information Center (United States, part of national activation)
NationalAudibleTest
National Audible Test (Canada)
NationalPeriodicTest
National Periodic Test (United States)
NationalSilentTest
National Silent Test (Canada)
RequiredMonthlyTest
Required Monthly Test
RequiredWeeklyTest
Required Weekly Test
AdministrativeMessage
Administrative Message
Used as follow-up for non-weather messages, including potentially to issue an all-clear.
Avalanche
Avalanche
Blizzard
Blizzard
BlueAlert
Blue Alert (state/local)
ChildAbduction
Child Abduction Emergency (state/local)
CivilDanger
Civil Danger Warning (state/local)
CivilEmergency
Civil Emergency Message (state/local)
CoastalFlood
Coastal Flood
DustStorm
Dust Storm
Earthquake
Earthquake Warning
NOTE: It is unclear if SAME is fast enough to provide timely notifications of earthquakes.
Evacuation
Evacuation Immediate
ExtremeWind
Extreme Wind
Fire
Fire Warning
FlashFlood
Flash Flood
FlashFreeze
Flash Freeze (Canada)
Flood
Flood
Freeze
Freeze (Canada)
HazardousMaterials
Hazardous Materials (Warning)
HighWind
High Wind
Hurricane
Hurricane
HurricaneLocalStatement
Hurricane Local Statement
LawEnforcementWarning
Law Enforcement Warning
LocalAreaEmergency
Local Area Emergency
NetworkMessageNotification
Network Message Notification
TelephoneOutage
911 Telephone Outage Emergency
NuclearPowerPlant
Nuclear Power Plant (Warning)
PracticeDemoWarning
Practice/Demo Warning
RadiologicalHazard
Radiological Hazard
SevereThunderstorm
Severe Thunderstorm
SevereWeather
Severe Weather Statement
ShelterInPlace
Shelter In Place
SnowSquall
Snow Squall
SpecialMarine
Special Marine
SpecialWeatherStatement
Special Weather Statement
StormSurge
Storm Surge
Tornado
Tornado Warning
TropicalStorm
Tropical Storm
Tsunami
Tsunami
Volcano
Volcano
WinterStorm
Winter Storm
Unrecognized
Unrecognized phenomenon
A catch-all for unrecognized event codes which either did not decode properly or are not known to sameold. If you encounter an Unrecognized event code in a production message, please report it as a bug right away.
Implementations§
Source§impl Phenomenon
impl Phenomenon
Sourcepub fn as_brief_str(&self) -> &'static str
pub fn as_brief_str(&self) -> &'static str
Describes the event without its accompanying severity information. For example,
assert_eq!(Phenomenon::RadiologicalHazard.as_brief_str(), "Radiological Hazard");as opposed to the full human-readable description of the event code,
“Radiological Hazard Warning.” If you want the full description,
use EventCode instead.
Sourcepub fn is_national(&self) -> bool
pub fn is_national(&self) -> bool
True if the phenomenon is associated with a national activation
Returns true if the underlying event code is typically used for national activations. This includes both live National Emergency Messages and the National Periodic Test.
Clients should consult the message’s location codes to determine if the message actually has national scope.
Sourcepub fn is_test(&self) -> bool
pub fn is_test(&self) -> bool
True if the phenomenon is associated with tests
Returns true if the underlying event code is used only for
tests. Test messages do not represent actual, real-world conditions.
Test messages should also have a
SignificanceLevel::Test.
Sourcepub fn is_weather(&self) -> bool
pub fn is_weather(&self) -> bool
True if the represented phenomenon is weather
In the United States, weather phenomenon codes like
“Severe Thunderstorm Warning” (SVR) are typically
only issued by the National Weather Service. The list of
weather event codes is taken from:
- “National Weather Service Instruction 10-1708,” 11 Dec 2017, https://www.nws.noaa.gov/directives/sym/pd01017008curr.pdf
Not all natural phenomenon are considered weather. Volcanoes, avalanches, and wildfires are examples of non-weather phenomenon that are naturally occurring. The National Weather Service does not itself issue these types of alerts; they are generally left to state and local authorities.
Sourcepub fn is_non_weather(&self) -> bool
pub fn is_non_weather(&self) -> bool
True if the represented phenomenon is not weather
The opposite of Phenomenon::is_weather(). The list of
non-weather event codes available for national, state, and/or
local use is taken from:
- “National Weather Service Instruction 10-1708,” 11 Dec 2017, https://www.nws.noaa.gov/directives/sym/pd01017008curr.pdf
Sourcepub fn is_unrecognized(&self) -> bool
pub fn is_unrecognized(&self) -> bool
True if the phenomenon is not recognized
assert!(Phenomenon::Unrecognized.is_unrecognized());Sourcepub fn is_recognized(&self) -> bool
pub fn is_recognized(&self) -> bool
True if the phenomenon is recognized
assert!(Phenomenon::TropicalStorm.is_recognized());The opposite of is_unrecognized().
Trait Implementations§
Source§impl AsRef<str> for Phenomenon
impl AsRef<str> for Phenomenon
Source§impl Clone for Phenomenon
impl Clone for Phenomenon
Source§fn clone(&self) -> Phenomenon
fn clone(&self) -> Phenomenon
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Phenomenon
impl Debug for Phenomenon
Source§impl Default for Phenomenon
impl Default for Phenomenon
Source§fn default() -> Phenomenon
fn default() -> Phenomenon
Source§impl Display for Phenomenon
impl Display for Phenomenon
Source§impl EnumMessage for Phenomenon
impl EnumMessage for Phenomenon
fn get_message(&self) -> Option<&'static str>
fn get_detailed_message(&self) -> Option<&'static str>
Source§fn get_documentation(&self) -> Option<&'static str>
fn get_documentation(&self) -> Option<&'static str>
fn get_serializations(&self) -> &'static [&'static str]
Source§impl EnumProperty for Phenomenon
impl EnumProperty for Phenomenon
Source§impl Hash for Phenomenon
impl Hash for Phenomenon
Source§impl IntoEnumIterator for Phenomenon
impl IntoEnumIterator for Phenomenon
Source§impl PartialEq for Phenomenon
impl PartialEq for Phenomenon
impl Copy for Phenomenon
impl Eq for Phenomenon
impl StructuralPartialEq for Phenomenon
Auto Trait Implementations§
impl Freeze for Phenomenon
impl RefUnwindSafe for Phenomenon
impl Send for Phenomenon
impl Sync for Phenomenon
impl Unpin for Phenomenon
impl UnwindSafe for Phenomenon
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.