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