Struct gtfs_rt::Alert

source ·
pub struct Alert {
Show 14 fields pub active_period: Vec<TimeRange>, pub informed_entity: Vec<EntitySelector>, pub cause: Option<i32>, pub effect: Option<i32>, pub url: Option<TranslatedString>, pub header_text: Option<TranslatedString>, pub description_text: Option<TranslatedString>, pub tts_header_text: Option<TranslatedString>, pub tts_description_text: Option<TranslatedString>, pub severity_level: Option<i32>, pub image: Option<TranslatedImage>, pub image_alternative_text: Option<TranslatedString>, pub cause_detail: Option<TranslatedString>, pub effect_detail: Option<TranslatedString>,
}
Expand description

An alert, indicating some sort of incident in the public transit network.

Fields§

§active_period: Vec<TimeRange>

Time when the alert should be shown to the user. If missing, the alert will be shown as long as it appears in the feed. If multiple ranges are given, the alert will be shown during all of them.

§informed_entity: Vec<EntitySelector>

Entities whose users we should notify of this alert.

§cause: Option<i32>§effect: Option<i32>§url: Option<TranslatedString>

The URL which provides additional information about the alert.

§header_text: Option<TranslatedString>

Alert header. Contains a short summary of the alert text as plain-text.

§description_text: Option<TranslatedString>

Full description for the alert as plain-text. The information in the description should add to the information of the header.

§tts_header_text: Option<TranslatedString>

Text for alert header to be used in text-to-speech implementations. This field is the text-to-speech version of header_text.

§tts_description_text: Option<TranslatedString>

Text for full description for the alert to be used in text-to-speech implementations. This field is the text-to-speech version of description_text.

§severity_level: Option<i32>§image: Option<TranslatedImage>

TranslatedImage to be displayed along the alert text. Used to explain visually the alert effect of a detour, station closure, etc. The image must enhance the understanding of the alert. Any essential information communicated within the image must also be contained in the alert text. The following types of images are discouraged : image containing mainly text, marketing or branded images that add no additional information. NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.

§image_alternative_text: Option<TranslatedString>

Text describing the appearance of the linked image in the image field (e.g., in case the image can’t be displayed or the user can’t see the image for accessibility reasons). See the HTML spec for alt image text - https://html.spec.whatwg.org/#alt. NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.

§cause_detail: Option<TranslatedString>

Description of the cause of the alert that allows for agency-specific language; more specific than the Cause. If cause_detail is included, then Cause must also be included. NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.

§effect_detail: Option<TranslatedString>

Description of the effect of the alert that allows for agency-specific language; more specific than the Effect. If effect_detail is included, then Effect must also be included. NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.

Implementations§

source§

impl Alert

source

pub fn cause(&self) -> Cause

Returns the enum value of cause, or the default if the field is unset or set to an invalid enum value.

source

pub fn set_cause(&mut self, value: Cause)

Sets cause to the provided enum value.

source

pub fn effect(&self) -> Effect

Returns the enum value of effect, or the default if the field is unset or set to an invalid enum value.

source

pub fn set_effect(&mut self, value: Effect)

Sets effect to the provided enum value.

source

pub fn severity_level(&self) -> SeverityLevel

Returns the enum value of severity_level, or the default if the field is unset or set to an invalid enum value.

source

pub fn set_severity_level(&mut self, value: SeverityLevel)

Sets severity_level to the provided enum value.

Trait Implementations§

source§

impl Clone for Alert

source§

fn clone(&self) -> Alert

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 Alert

source§

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

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

impl Default for Alert

source§

fn default() -> Self

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

impl Message for Alert

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for Alert

source§

fn eq(&self, other: &Alert) -> 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 Serialize for Alert

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for Alert

Auto Trait Implementations§

§

impl Freeze for Alert

§

impl RefUnwindSafe for Alert

§

impl Send for Alert

§

impl Sync for Alert

§

impl Unpin for Alert

§

impl UnwindSafe for Alert

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> 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> ToOwned for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.