Enum sameold::Originator

source ·
pub enum Originator {
    Unknown,
    PrimaryEntryPoint,
    CivilAuthority,
    WeatherService,
    NationalWeatherService,
    EnvironmentCanada,
    BroadcastStation,
}
Expand description

SAME message originator code

See Message::originator(). Originator codes may be converted from() their SAME string representations. Using them .as_ref() or via Display will show a human-readable string.

The variants NationalWeatherService and EnvironmentCanada must be constructed using both the originator string and the station callsign.

use sameold::Originator;

let orig = Originator::from("WXR");
assert_eq!(Originator::WeatherService, orig);
assert_eq!("WXR", orig.as_ref());
assert_eq!("Weather Service", orig.as_display_str());
assert_eq!("Weather Service", &format!("{}", orig));

assert_eq!(Originator::Unknown, Originator::from("HUH"));

let orig = Originator::from(("WXR", "KLOX/NWS"));
assert_eq!("National Weather Service", orig.as_display_str());
assert_eq!("WXR", orig.as_str());

assert_eq!(Originator::EnvironmentCanada,
           Originator::from(("WXR", "EC/GC/CA")));

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

§

WeatherService

National Weather Service or Environment Canada

§

NationalWeatherService

National Weather Service

§

EnvironmentCanada

Environment Canada

§

BroadcastStation

EAS participant (usu. broadcast station)

Implementations§

source§

impl Originator

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_str(&self) -> &'static str

SAME string representation

Returns the three-character SAME code for this Originator

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 copy 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

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

impl Display for Originator

source§

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

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_serializations(&self) -> &'static [&'static str]

source§

impl From<&str> for Originator

source§

fn from(s: &str) -> Originator

Converts to this type from the input type.
source§

impl From<(&str, &str)> for Originator

source§

fn from(orig_and_call: (&str, &str)) -> Originator

Converts to this type from the input type.
source§

impl FromStr for Originator

§

type Err = ParseError

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

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

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

impl Hash for Originator

source§

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

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

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Originator

source§

impl Eq for Originator

source§

impl StructuralEq for Originator

source§

impl StructuralPartialEq for Originator

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> Scalar for Twhere T: Copy + PartialEq<T> + Debug + Any,

source§

fn inlined_clone(&self) -> T

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

fn is<T>() -> boolwhere T: Scalar,

Tests if Self the same as the type T Read more
§

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

§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.