pub trait Abs {
fn abs(self) -> Self;
}
Abs
is used for implementing an abs()
member for types that
can have their absolute value taken (which is most of them).
extern crate dimensioned as dim;
use dim::si;
fn main() {
let t = -2.0 * si::S;
let abst = 2.0 * si::S;
use dim::Abs;
assert_eq!(t.abs(), abst);
}
fn abs(self) -> Self
The method for taking the absolute value
impl<V: Abs, U> Abs for SI<V, U> | |
impl<V: Abs, U> Abs for MKS<V, U> | |
impl<V: Abs, U> Abs for CGS<V, U> | |
impl<V: Abs, U> Abs for FPS<V, U> | |