AtmosphereError

Struct AtmosphereError 

Source
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

Source

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.

Source

pub fn temperature_refusal( &self, field: AirField<'_>, units: AirUnits, ) -> AirRefusal

Name a refusal discovered aloft using the same temperature source as the station check.

Source

pub fn temperature_refusal_from( &self, field: AirField<'_>, units: AirUnits, origin: StationTemperatureOrigin, ) -> AirRefusal

Like Self::temperature_refusal, retaining a density altitude’s derived temperature.

Source

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.

Source

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.

Source

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.

Source

pub fn field(&self) -> &str

The refused field’s name or path.

Source

pub fn value(&self) -> f64

The value that was refused, unchanged.

Source

pub fn reason(&self) -> AtmosphereErrorReason

Why it was refused.

Source

pub fn at_field(self, field: impl Into<Cow<'static, str>>) -> Self

The same error under the caller’s own name for the field, for example "$.atmosphere.relative_humidity".

Source§

impl AtmosphereError

Source

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:

  1. 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);
  2. 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;
  3. 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

Source§

fn clone(&self) -> AtmosphereError

Returns a duplicate 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 AtmosphereError

Source§

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

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

impl Display for AtmosphereError

Source§

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

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

impl Error for AtmosphereError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<AtmosphereError> for BallisticsError

Source§

fn from(error: AtmosphereError) -> Self

Converts to this type from the input type.
Source§

impl From<AtmosphereError> for KernelInputError

Source§

fn from(source: AtmosphereError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AtmosphereError

Source§

fn eq(&self, other: &AtmosphereError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AtmosphereError

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,