pub struct AtmosphereError { /* private fields */ }Expand description
An atmosphere value refused at a boundary: which field, the value given, and why.
The constructors name their own parameters (humidity_percent, relative_humidity,
temperature_c, pressure_hpa, …). A boundary that knows the caller’s path, such as a
JSON pointer, relabels the error with Self::at_field, or states the whole refusal in its
own words with Self::refusal_in. It displays as "<field> = <value>: <explanation>".
Implementations§
Source§impl AtmosphereError
impl AtmosphereError
Sourcepub fn in_error<'a>(error: &'a (dyn Error + 'static)) -> Option<&'a Self>
pub fn in_error<'a>(error: &'a (dyn Error + 'static)) -> Option<&'a Self>
Find a typed atmosphere refusal through a service’s error chain. Keep the cause until the boundary can name the reading in its own units.
Sourcepub fn temperature_refusal(
&self,
field: AirField<'_>,
units: AirUnits,
) -> AirRefusal
pub fn temperature_refusal( &self, field: AirField<'_>, units: AirUnits, ) -> AirRefusal
Name a refusal discovered aloft using the same temperature source as the station check.
Sourcepub fn temperature_refusal_from(
&self,
field: AirField<'_>,
units: AirUnits,
origin: StationTemperatureOrigin,
) -> AirRefusal
pub fn temperature_refusal_from( &self, field: AirField<'_>, units: AirUnits, origin: StationTemperatureOrigin, ) -> AirRefusal
Like Self::temperature_refusal, retaining a density altitude’s derived temperature.
Sourcepub fn explanation(&self) -> String
pub fn explanation(&self) -> String
Why the value was refused, in words: the reason’s own text, naming the quantity and the
range it must lie in where the reason alone would not. A relative humidity that is not
finite is “relative humidity must be a finite percent from 0 to 100 (a sensor reading
from -5 to 105 is read as 0 or 100)”, not a bare “must be finite”; every other refusal is
its AtmosphereErrorReason’s text.
For a caller that names the field itself (a flag parser). Any altitude it quotes is in
metres; Self::explanation_in states it in another unit.
Sourcepub fn explanation_in(&self, altitude_unit: AltitudeUnit) -> String
pub fn explanation_in(&self, altitude_unit: AltitudeUnit) -> String
Self::explanation with any altitude it quotes (where air that cannot exist aloft
reaches absolute zero) in altitude_unit: "... reaches 0 K at 5049 ft above mean sea level ..." in feet.
Sourcepub fn altitude_m(&self) -> Option<f64>
pub fn altitude_m(&self) -> Option<f64>
For air that cannot exist aloft (AtmosphereErrorReason::AirAloftBelowAbsoluteZero),
the geometric altitude above mean sea level, m, at which the lapse from the refused
temperature reaches absolute zero; None for every other refusal.
Sourcepub fn reason(&self) -> AtmosphereErrorReason
pub fn reason(&self) -> AtmosphereErrorReason
Why it was refused.
Source§impl AtmosphereError
impl AtmosphereError
Sourcepub fn refusal_in(
&self,
spelling: &AirSpelling<'_>,
station_altitude_m: f64,
station_temperature_c: f64,
station_pressure_hpa: f64,
) -> AirRefusal
pub fn refusal_in( &self, spelling: &AirSpelling<'_>, station_altitude_m: f64, station_temperature_c: f64, station_pressure_hpa: f64, ) -> AirRefusal
This refusal of a station’s air, stated in a surface’s own words.
spelling names the surface’s readings and carries their values in its units;
station_altitude_m, station_temperature_c and station_pressure_hpa are the station
the solve resolved. A refusal for any reason but air that cannot exist blames the reading
this error names, in the surface’s units (a temperature at or below absolute zero states
absolute zero in AirSpelling::temperature_unit; a density altitude no air has is the
field AirSpelling::altitude names, since a surface that flies one names its altitude by
it). Air that cannot exist is blamed by one rule on every surface, so every surface
locates the same air at the same reading:
- the temperature, when the air is humid above water’s critical point (647.096 K), or
the temperature is outside 173.15 K to 373.15 K (-100 °C to 100 °C, where the humid-air
formulas hold). Such a temperature is refused by no surface on its own (the humidity
terms are extrapolated there); with air that cannot exist it is the likelier mistake.
The message names it where it came from (
AirSpelling::temperature_origin): the reading (; temperature = 214 °F is outside -148 °F to 212 °F, ...: check the temperature and its unit), or the density altitude that gave it (; density_altitude gives a station temperature of ...: check the density altitude's unit); - when the station pressure’s pressure altitude is outside the troposphere, the reading
that put it there (
AirSpelling::pressure_origin): the pressure when it was a reading, because a pressure in the wrong unit (hPa sent as pascals) is far likelier than a humidity of 50 % in air 25 km up, and the altitude when the pressure was the standard pressure there or a plausible QNH reduced there (feet sent as metres), the density altitude when a density altitude gave it. The message says which unit to check, and quotes a QNH as it was sent (AirSpelling::qnh_text), with the station pressure it was reduced to; - otherwise the humidity.
A QNH the altimeter-setting relation leaves no station pressure for is quoted as it was sent too, never as the NaN it reduced to: blamed on the altitude when it is a plausible sea-level pressure, on the pressure otherwise.
Trait Implementations§
Source§impl Clone for AtmosphereError
impl Clone for AtmosphereError
Source§fn clone(&self) -> AtmosphereError
fn clone(&self) -> AtmosphereError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AtmosphereError
impl Debug for AtmosphereError
Source§impl Display for AtmosphereError
impl Display for AtmosphereError
Source§impl Error for AtmosphereError
impl Error for AtmosphereError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<AtmosphereError> for BallisticsError
impl From<AtmosphereError> for BallisticsError
Source§fn from(error: AtmosphereError) -> Self
fn from(error: AtmosphereError) -> Self
Source§impl From<AtmosphereError> for KernelInputError
impl From<AtmosphereError> for KernelInputError
Source§fn from(source: AtmosphereError) -> Self
fn from(source: AtmosphereError) -> Self
Source§impl PartialEq for AtmosphereError
impl PartialEq for AtmosphereError
impl StructuralPartialEq for AtmosphereError
Auto Trait Implementations§
impl Freeze for AtmosphereError
impl RefUnwindSafe for AtmosphereError
impl Send for AtmosphereError
impl Sync for AtmosphereError
impl Unpin for AtmosphereError
impl UnwindSafe for AtmosphereError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.