pub struct Picometer(pub f64);Expand description
A value in picometers (pm).
Basic arithmetic is implemented for convenience, and the underlying f64 value is accessible as a tuple field.
§Example
use mendeleev::Picometer;
use core::cmp::Ordering;
let value1 = Picometer(1.0);
let value2 = Picometer(2.0);
assert_eq!(value1.0, 1.0);
assert!(value1 < value2);
assert_eq!(value1.total_cmp(&value2), Ordering::Less);
assert_eq!(value1 + value2, Picometer(3.0));
assert_eq!(value1 - value2, Picometer(-1.0));
assert_eq!(value1 * 5.0, Picometer(5.0));
assert_eq!(value1 / 4.0, Picometer(0.25));Tuple Fields§
§0: f64Implementations§
Trait Implementations§
Source§impl Display for Picometer
impl Display for Picometer
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Displays the value along with the unit. Supports numeric formatting.
A space is added between the number and the unit, in accordance with the SI convention.
§Example
use mendeleev::Picometer;
let value = Picometer(1.2345);
assert_eq!(format!("{value:.1}"), "1.2 pm");Source§impl PartialOrd for Picometer
impl PartialOrd for Picometer
impl Copy for Picometer
impl StructuralPartialEq for Picometer
Auto Trait Implementations§
impl Freeze for Picometer
impl RefUnwindSafe for Picometer
impl Send for Picometer
impl Sync for Picometer
impl Unpin for Picometer
impl UnwindSafe for Picometer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more