pub struct QuantityDescriptor {
pub key: &'static str,
pub si_label: &'static str,
pub us_label: &'static str,
pub si_to_us_scale: f64,
pub si_to_us_offset: f64,
pub si_decimals: u8,
pub us_decimals: u8,
}Expand description
Descriptor of one physical quantity in an engine’s catalog (spec §5).
Quantity keys are engine-scoped: two engines may both declare a flow
quantity without their descriptors agreeing, because no value ever
crosses between engines.
Fields§
§key: &'static strStable quantity identifier, opaque to this layer; referenced by attribute schemas (spec §4.4) and result variables (spec §6).
si_label: &'static strUnit text in the SI display system (e.g. “m”, “L/s”, “mm/hr”).
us_label: &'static strUnit text in the US-customary display system (e.g. “ft”, “gpm”).
si_to_us_scale: f64Scale of the affine SI→US display conversion:
us = si * si_to_us_scale + si_to_us_offset.
si_to_us_offset: f64Offset of the affine SI→US display conversion. Zero for all but temperature-like quantities.
si_decimals: u8Suggested display precision in the SI system. Advisory.
us_decimals: u8Suggested display precision in the US system. Advisory.
Implementations§
Source§impl QuantityDescriptor
impl QuantityDescriptor
Sourcepub fn label(&self, family: DisplayFamily) -> &'static str
pub fn label(&self, family: DisplayFamily) -> &'static str
The unit label for one display family.
Sourcepub fn from_si(&self, si: f64, family: DisplayFamily) -> f64
pub fn from_si(&self, si: f64, family: DisplayFamily) -> f64
Re-express an SI display value in family.
Sourcepub fn decimals(&self, family: DisplayFamily) -> u8
pub fn decimals(&self, family: DisplayFamily) -> u8
The advisory display precision for one family.
Trait Implementations§
Source§impl Clone for QuantityDescriptor
impl Clone for QuantityDescriptor
Source§fn clone(&self) -> QuantityDescriptor
fn clone(&self) -> QuantityDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more