Yet Another Units of Measurement library
This crate provides type-safe basic scientific units and constants for no_std
programs.
Example
use *;
use *;
use *;
// Simple arithmetic
assert_eq!;
assert_eq!;
// Read value in a given unit
assert_eq!;
assert_eq!;
Currently supported units:
time
: Timeangle
: Angle, angular speedfrequency
: Frequency, sampling frequencylength
: Lengthvelocity
: Velocity, acceleration
Define custom units and conversions using the impl_unit!
, convert_div!
and convert_unit!
macros.
# extern crate yaum;
use *;
use *;
impl_unit!;
impl_unit!;
// define conversion between the two units (1 byte = 8 bits):
convert_unit!;
impl_unit!;
// define relationship between units (BitSpeed = BitSize/Time)
convert_div!;
Precision
By default, units are implemented on top of f32
. Enable the double_precision
feature for f64
.
[]
= "0.1.0"
= false
= ["double_precision"]