Struct yaiouom::RuntimeUnit
[−]
[src]
pub struct RuntimeUnit { /* fields omitted */ }
Runtime representation of a unit.
Used mainly for debug assertions and for debug formatting.
Methods
impl RuntimeUnit
[src]
pub fn to_string(&self) -> String
[src]
Display a RuntimeUnit as a string.
Positives come before negatives, but otherwise, the order of elements
is not specified. A dimensionless unit returns ""
.
use yaiouom::*; use yaiouom::si::*; let unit_str = Mul::<Meter, Inv<Second>>::as_runtime().to_string(); assert_eq!(&unit_str, "m * s^-1"); let unit_str_2 = Mul::<Inv<Second>, Meter>::as_runtime().to_string(); assert_eq!(&unit_str_2, "m * s^-1"); let unit_str_3 = Mul::<Inv<Second>, Mul<Inv<Second>, Meter>>::as_runtime().to_string(); assert_eq!(&unit_str_3, "m * s^-2"); let unit_str_4 = Mul::<Inv<Ampere>, Mul<Inv<Second>, Meter>>::as_runtime().to_string(); assert!(["m * s^-1 * A^-1", "m * A^-1 * s^-1"].iter().any(|x| *x == &unit_str_4));
Performance note
This method is fine for debugging, but should not be used in a tight loop.
Trait Implementations
impl PartialEq for RuntimeUnit
[src]
fn eq(&self, __arg_0: &RuntimeUnit) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &RuntimeUnit) -> bool
[src]
This method tests for !=
.