pub enum Originator {
Unknown,
PrimaryEntryPoint,
CivilAuthority,
NationalWeatherService,
EnvironmentCanada,
BroadcastStation,
}Expand description
SAME message originator code
See MessageHeader::originator().
Originator codes may be also parsed from the SAME
org code and callsign:
use sameplace::Originator;
let orig = Originator::from_org_and_call("WXR", "KLOX/NWS");
assert_eq!(Originator::NationalWeatherService, orig);
// other originators
assert_eq!(Originator::Unknown, Originator::from_org_and_call("HUH", ""));
assert_eq!("CIV", Originator::CivilAuthority.as_code_str());Originators Display a human-readable string:
assert_eq!("National Weather Service", orig.as_display_str());
assert_eq!("National Weather Service", &format!("{}", orig));
assert_eq!("WXR", orig.as_ref());
assert_eq!("WXR", &format!("{:#}", orig));The callsign is required to reliably detect the National Weather Service and/or Environment Canada:
assert_eq!(Originator::EnvironmentCanada,
Originator::from_org_and_call("WXR", "EC/GC/CA"));
assert_eq!("WXR", Originator::EnvironmentCanada.as_code_str());Variants§
Unknown
An unknown (and probably invalid) Originator code
Per NWSI 10-172, receivers should accept any originator code.
PrimaryEntryPoint
Primary Entry Point station for national activations
Nation-wide activations are authorized by the President of the United States. Takes priority over all other messages/station programming.
CivilAuthority
Civil authorities
NationalWeatherService
National Weather Service
EnvironmentCanada
Environment Canada
In Canada, SAME is only transmitted on the Weatheradio Canada radio network to alert weather radios. SAME signals are not transmitted on broadcast AM/FM or cable systems.
This enum variant will only be selected if the sending station’s callsign matches the format of Environment Canada stations.
BroadcastStation
EAS participant (usu. broadcast station)
Implementations§
Source§impl Originator
impl Originator
Sourcepub fn from_org_and_call<S1, S2>(org: S1, call: S2) -> Originator
pub fn from_org_and_call<S1, S2>(org: S1, call: S2) -> Originator
Construct from originator string and station callsign
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 “Civil authorities.”
Sourcepub fn as_code_str(&self) -> &'static str
pub fn as_code_str(&self) -> &'static str
SAME string representation
Returns the SAME code for this Originator.
Originator::Unknown returns the empty string.
Trait Implementations§
Source§impl AsRef<str> for Originator
impl AsRef<str> for Originator
Source§impl Clone for Originator
impl Clone for Originator
Source§fn clone(&self) -> Originator
fn clone(&self) -> Originator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Originator
impl Debug for Originator
Source§impl Default for Originator
impl Default for Originator
Source§fn default() -> Originator
fn default() -> Originator
Source§impl Display for Originator
impl Display for Originator
Source§impl EnumMessage for Originator
impl EnumMessage for Originator
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 FromStr for Originator
impl FromStr for Originator
Source§type Err = ParseError
type Err = ParseError
Source§fn from_str(s: &str) -> Result<Originator, <Originator as FromStr>::Err>
fn from_str(s: &str) -> Result<Originator, <Originator as FromStr>::Err>
s to return a value of this type. Read moreSource§impl Hash for Originator
impl Hash for Originator
Source§impl PartialEq for Originator
impl PartialEq for Originator
Source§impl TryFrom<&str> for Originator
impl TryFrom<&str> for Originator
Source§type Error = ParseError
type Error = ParseError
Source§fn try_from(s: &str) -> Result<Originator, <Originator as TryFrom<&str>>::Error>
fn try_from(s: &str) -> Result<Originator, <Originator as TryFrom<&str>>::Error>
impl Copy for Originator
impl Eq for Originator
impl StructuralPartialEq for Originator
Auto Trait Implementations§
impl Freeze for Originator
impl RefUnwindSafe for Originator
impl Send for Originator
impl Sync for Originator
impl Unpin for Originator
impl UnwindSafe for Originator
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.