#[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,
}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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
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.
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Product
impl<'de> Deserialize<'de> for Product
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Product
Auto Trait Implementations§
impl Freeze for Product
impl RefUnwindSafe for Product
impl Send for Product
impl Sync for Product
impl Unpin for Product
impl UnsafeUnpin for Product
impl UnwindSafe for Product
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more