#[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
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.

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

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.

Human-readable string representation

Converts to a human-readable string, like “Required Monthly Test.”

SAME string representation

Returns the three-character SAME code for this EventCode.

Trait Implementations

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Convert to significance level

Converts to this type from the input type.

Converts to this type from the input type.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

Performance hack: Clone doesn’t get inlined for Copy types in debug mode, so make it inline anyway.

Tests if Self the same as the type T Read more

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

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

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

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

The resulting type after obtaining ownership.

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.