#[non_exhaustive]pub struct MetarObservation {
pub temperature_c: Option<f64>,
pub dewpoint_c: Option<f64>,
pub wind_dir_deg: Option<u16>,
pub wind_variable: bool,
pub wind_speed_kt: Option<u16>,
pub wind_gust_kt: Option<u16>,
pub visibility_sm: Option<f64>,
pub altimeter_hpa: Option<f64>,
pub clouds: Vec<CloudLayer>,
pub reported_category: Option<FlightCategory>,
}Expand description
A decoded METAR observation. Every field is optional: a real report may omit any of them, and a caller must treat absence as “unknown”, never as a safe default.
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.temperature_c: Option<f64>Air temperature, °C.
dewpoint_c: Option<f64>Dewpoint, °C.
wind_dir_deg: Option<u16>Wind direction, degrees true; None when variable or unreported.
wind_variable: boolWhether the wind direction is reported variable (VRB).
wind_speed_kt: Option<u16>Sustained wind speed, knots.
wind_gust_kt: Option<u16>Gust speed, knots.
visibility_sm: Option<f64>Prevailing visibility, statute miles. "10+" decodes to 10.0.
altimeter_hpa: Option<f64>Altimeter setting, hectopascals (the AWC source unit).
clouds: Vec<CloudLayer>Cloud layers, lowest first as reported.
reported_category: Option<FlightCategory>The category AWC itself reported (fltCat), for cross-checking
against Self::flight_category.
Implementations§
Source§impl MetarObservation
impl MetarObservation
Sourcepub fn ceiling_ft(&self) -> Option<f64>
pub fn ceiling_ft(&self) -> Option<f64>
Lowest ceiling base with a known, finite height (broken / overcast
/ obscured), feet AGL. None when no ceiling layer has a known
height — which may mean unlimited or a ceiling whose height was
not reported; use Self::has_unknown_height_ceiling to tell
them apart.
Sourcepub fn has_unknown_height_ceiling(&self) -> bool
pub fn has_unknown_height_ceiling(&self) -> bool
Whether a ceiling layer (broken/overcast/obscured) is present but its height is missing or non-finite. Such a ceiling must never be read as “unlimited”: the true ceiling could be at any height.
Sourcepub fn flight_category(&self) -> Option<FlightCategory>
pub fn flight_category(&self) -> Option<FlightCategory>
Flight category derived from Self::ceiling_ft and
Self::visibility_sm — the source of truth for a go/no-go
check, independent of AWC’s reported value.
Returns None (uncategorizable) when visibility is unknown, or
when a ceiling layer of unknown height could be lower than
anything known and the result is not already the most restrictive
category. A go/no-go caller must treat None conservatively, never
as VFR.
Sourcepub fn altimeter_inhg(&self) -> Option<f64>
pub fn altimeter_inhg(&self) -> Option<f64>
Altimeter setting converted to inches of mercury.
Sourcepub fn with_temperature_c(self, value: Option<f64>) -> Self
pub fn with_temperature_c(self, value: Option<f64>) -> Self
Set the temperature (°C).
Sourcepub fn with_dewpoint_c(self, value: Option<f64>) -> Self
pub fn with_dewpoint_c(self, value: Option<f64>) -> Self
Set the dewpoint (°C).
Sourcepub fn with_wind_dir(self, deg: Option<u16>, variable: bool) -> Self
pub fn with_wind_dir(self, deg: Option<u16>, variable: bool) -> Self
Set the wind direction (degrees true) and whether it is variable.
Sourcepub fn with_wind_speed(
self,
speed_kt: Option<u16>,
gust_kt: Option<u16>,
) -> Self
pub fn with_wind_speed( self, speed_kt: Option<u16>, gust_kt: Option<u16>, ) -> Self
Set the wind speed and gust (knots).
Sourcepub fn with_visibility_sm(self, value: Option<f64>) -> Self
pub fn with_visibility_sm(self, value: Option<f64>) -> Self
Set the prevailing visibility (statute miles).
Sourcepub fn with_altimeter_hpa(self, value: Option<f64>) -> Self
pub fn with_altimeter_hpa(self, value: Option<f64>) -> Self
Set the altimeter setting (hectopascals).
Sourcepub fn with_clouds(self, clouds: Vec<CloudLayer>) -> Self
pub fn with_clouds(self, clouds: Vec<CloudLayer>) -> Self
Set the cloud layers.
Sourcepub fn with_reported_category(self, value: Option<FlightCategory>) -> Self
pub fn with_reported_category(self, value: Option<FlightCategory>) -> Self
Set AWC’s reported category.
Trait Implementations§
Source§impl Clone for MetarObservation
impl Clone for MetarObservation
Source§fn clone(&self) -> MetarObservation
fn clone(&self) -> MetarObservation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetarObservation
impl Debug for MetarObservation
Source§impl Default for MetarObservation
impl Default for MetarObservation
Source§fn default() -> MetarObservation
fn default() -> MetarObservation
Source§impl<'de> Deserialize<'de> for MetarObservation
impl<'de> Deserialize<'de> for MetarObservation
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>,
Source§impl PartialEq for MetarObservation
impl PartialEq for MetarObservation
Source§fn eq(&self, other: &MetarObservation) -> bool
fn eq(&self, other: &MetarObservation) -> bool
self and other values to be equal, and is used by ==.