#[non_exhaustive]pub struct Product {
pub kind: ProductKind,
pub location: Option<String>,
pub issued_at: Option<DateTime<Utc>>,
pub valid: Option<ValidPeriod>,
pub raw_text: String,
pub observation: Option<MetarObservation>,
}Expand description
One discrete weather product, kept verbatim as published.
#[non_exhaustive]: construct with Product::new and the with_*
setters, so a future source (e.g. FIS-B) can add fields without breaking
existing construction sites.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: ProductKindWhat kind of product this is.
location: Option<String>Station or location identifier when the product is tied to one.
issued_at: Option<DateTime<Utc>>Issue/observation time when the source provides one.
valid: Option<ValidPeriod>Validity window when the product defines one (a TAF’s forecast
period); None for instantaneous reports such as a METAR.
raw_text: StringVerbatim product text as published by the source.
observation: Option<MetarObservation>Decoded observation fields, for METAR/SPECI products that carry them; the raw text above is always authoritative.
Implementations§
Source§impl Product
impl Product
Sourcepub fn new(kind: ProductKind, raw_text: impl Into<String>) -> Self
pub fn new(kind: ProductKind, raw_text: impl Into<String>) -> Self
A product of kind carrying its verbatim raw_text. Optional fields
default to None; set them with the with_* builders.
Sourcepub fn with_location(self, location: Option<String>) -> Self
pub fn with_location(self, location: Option<String>) -> Self
Set the station/location identifier.
Sourcepub fn with_issued_at(self, issued_at: Option<DateTime<Utc>>) -> Self
pub fn with_issued_at(self, issued_at: Option<DateTime<Utc>>) -> Self
Set the issue/observation time.
Sourcepub fn with_valid(self, valid: Option<ValidPeriod>) -> Self
pub fn with_valid(self, valid: Option<ValidPeriod>) -> Self
Set the validity window.
Sourcepub fn with_observation(self, observation: Option<MetarObservation>) -> Self
pub fn with_observation(self, observation: Option<MetarObservation>) -> Self
Attach decoded observation fields (METAR/SPECI).