Macro mag::length_unit
source · [−]macro_rules! length_unit {
($(#[$doc:meta])* $unit:ident, $label:expr, $m_factor:expr) => { ... };
}
Expand description
Define a custom unit of length
unit
Unit struct namelabel
Standard unit labelm_factor
Factor to convert to meters
Example: Football Field
use mag::{length_unit, length::yd};
length_unit!(FootballField, "fbf", 91.44);
assert_eq!((1 * FootballField).to(), 100 * yd);