Adds quantities and units to rust to allow unit safe computation with zero cost abstraction.
Note: this crate uses an unstable feature which requires you to add #![feature(generic_const_exprs)]
and use the nightly compiler.
Add the generic_const_exprs
feature by adding #![feature(generic_const_exprs)]
to your main.rs
or lib.rs
file.
```rust use measurement::si::{Length, Time, Velocity};
fn main() { let length = Length::new(20.0); // 20m let time = Time::new(5.0); // 5s
// you can specify the type of the quantity but you don't have to
// (see the example below)
let velocity: Velocity = length / time;
println!("{}", velocity.value);
} ```
```rust use measurement::si::{Mass, Acceleration};
fn main() { let mass = Mass::new(50.0); let acceleration = Acceleration::new(10.0);
let force = mass * acceleration;
println!("{}", force.value);
} ```
currently only three dimensions are supported: Time, Length, Mass
```rust use measurement::{Quantity, Dimension};
pub type Length = Quantity
pub type Velocity = Quantity
```