Originator

Enum Originator 

Source
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

Source

pub fn from_org_and_call<S1, S2>(org: S1, call: S2) -> Originator
where S1: AsRef<str>, S2: AsRef<str>,

Construct from originator string and station callsign

Source

pub fn as_display_str(&self) -> &'static str

Human-readable string representation

Converts to a human-readable string, like “Civil authorities.”

Source

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

Source§

fn as_ref(&self) -> &'static str

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

impl Clone for Originator

Source§

fn clone(&self) -> Originator

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 Originator

Source§

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

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

impl Default for Originator

Source§

fn default() -> Originator

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

impl Display for Originator

Source§

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

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

impl EnumMessage for Originator

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 FromStr for Originator

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Originator, <Originator as FromStr>::Err>

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

impl Hash for Originator

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 PartialEq for Originator

Source§

fn eq(&self, other: &Originator) -> 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 TryFrom<&str> for Originator

Source§

type Error = ParseError

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

fn try_from(s: &str) -> Result<Originator, <Originator as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for Originator

Source§

impl Eq for Originator

Source§

impl StructuralPartialEq for Originator

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,