pub trait LinearScaledUnit: Unit {
const REF_UNIT: Self;
// Required method
fn scale(&self) -> AmountT;
// Provided methods
fn from_scale(amnt: AmountT) -> Option<Self> { ... }
fn is_ref_unit(&self) -> bool { ... }
fn ratio(&self, other: &Self) -> AmountT { ... }
}
Expand description
Type of units being linear scaled in terms of a reference unit.
Required Associated Constants§
Required Methods§
Provided Methods§
Sourcefn from_scale(amnt: AmountT) -> Option<Self>
fn from_scale(amnt: AmountT) -> Option<Self>
Returns Some(unit)
where unit.scale()
== Some(amnt)
, or None
if there is no such unit.
Sourcefn is_ref_unit(&self) -> bool
fn is_ref_unit(&self) -> bool
Returns true
if self
is the reference unit of its unit type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.