pub trait Prefix:
Clone
+ Copy
+ Default
+ PartialEq
+ FromStr
+ Display
+ Debug {
// Required method
fn relative_magnitude(&self) -> u128;
// Provided methods
fn conversion_factor(&self, to: Self) -> Result<u128, String> { ... }
fn conversion_factor_lossy(&self, to: Self) -> f64 { ... }
}
Expand description
The prefix of a unit value denoting magnitude. Common prefixes are SI prefixes (nano, micro, milli, etc).
Required Methods§
sourcefn relative_magnitude(&self) -> u128
fn relative_magnitude(&self) -> u128
The magnitude of this prefix relative to other prefixes of this type.
Provided Methods§
sourcefn conversion_factor(&self, to: Self) -> Result<u128, String>
fn conversion_factor(&self, to: Self) -> Result<u128, String>
An integer conversion factor.
sourcefn conversion_factor_lossy(&self, to: Self) -> f64
fn conversion_factor_lossy(&self, to: Self) -> f64
A floating point conversion factor.
Object Safety§
This trait is not object safe.