#[repr(u8)]
pub enum SignificanceLevel {
    Test,
    Message,
    Statement,
    Emergency,
    Watch,
    Warning,
}
Expand description

SAME message significance level

Usually constructed as part of an EventCode. See also MessageHeader::event()

Significance levels have a single-character text representation, like “T” for Test. You can attempt to convert from string:

use sameold::{SignificanceLevel, UnknownSignificanceLevel};

assert_eq!(SignificanceLevel::Watch, SignificanceLevel::try_from("zzA").unwrap());
assert_eq!(UnknownSignificanceLevel {}, SignificanceLevel::try_from("").unwrap_err());
assert_eq!(SignificanceLevel::Test, SignificanceLevel::try_from("T").unwrap());

If a multi-character string is given as input, the last character will be used. The last byte must be valid UTF-8. In all situations where a valid SignificanceLevel can’t be constructed, an error is returned.

Significance levels are Ord. Lower significance levels represent less urgent messages, such as tests and statements. Higher significance levels represent more important or urgent messages which may merit a “noisy” notification.


assert!(SignificanceLevel::Test < SignificanceLevel::Warning);
assert!(SignificanceLevel::Watch < SignificanceLevel::Warning);

Variants

Test

Test

A message intended only for testing purposes. “This is only a test.”

Message

Message

A non-emergency message

Statement

Statement

A message containing follow up information to a warning, watch, or emergency (NWSI 10-1712).

Emergency

Emergency

An event that by itself would not kill or injure or do property damage, but indirectly may cause other things to happen that result in a hazard. Example, a major power or telephone loss in a large city alone is not a direct hazard but disruption to other critical services could create a variety of conditions that could directly threaten public safety (NWSI 10-1712).

Watch

Watch

Meets the classification of a warning, but either the onset time, probability of occurrence, or location is uncertain (NWSI 10-1712).

Warning

Warning (the most severe event)

Those events that alone pose a significant threat to public safety and/or property, probability of occurrence and location is high, and the onset time is relatively short (NWSI 10-1712).

Implementations

Human-readable string representation

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

SAME string representation

Returns the one-character SAME code for this SignificanceLevel. While this is usually the last character of the EventCode, there are many exceptions to this rule.

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

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 returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Convert from string representation

Matches a standard-form EAS event code, such as xxT for Test, and converts it to its enumerated type. If the given string does not end in a significance level, UnknownSignificanceLevel is returned.

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.