Phenomenon

Enum Phenomenon 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

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.

Source

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.

Source

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.

Source

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:

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.

Source

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:

Source

pub fn is_unrecognized(&self) -> bool

True if the phenomenon is not recognized

assert!(Phenomenon::Unrecognized.is_unrecognized());
Source

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

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Phenomenon

Source§

fn clone(&self) -> Phenomenon

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Phenomenon

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Phenomenon

Source§

fn default() -> Phenomenon

Returns the “default value” for a type. Read more
Source§

impl Display for Phenomenon

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl EnumMessage for Phenomenon

Source§

fn get_message(&self) -> Option<&'static str>

Source§

fn get_detailed_message(&self) -> Option<&'static str>

Source§

fn get_documentation(&self) -> Option<&'static str>

Get the doc comment associated with a variant if it exists.
Source§

fn get_serializations(&self) -> &'static [&'static str]

Source§

impl EnumProperty for Phenomenon

Source§

fn get_str(&self, prop: &str) -> Option<&'static str>

Source§

fn get_int(&self, prop: &str) -> Option<i64>

Source§

fn get_bool(&self, prop: &str) -> Option<bool>

Source§

impl Hash for Phenomenon

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for Phenomenon

Source§

type Iterator = PhenomenonIter

Source§

fn iter() -> PhenomenonIter

Source§

impl PartialEq for Phenomenon

Source§

fn eq(&self, other: &Phenomenon) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Phenomenon

Source§

impl Eq for Phenomenon

Source§

impl StructuralPartialEq for Phenomenon

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,