macro_rules! length_unit {
    ($(#[$doc:meta])* $unit:ident, $label:expr, $m_factor:expr) => { ... };
}
Expand description

Define a custom unit of length

  • unit Unit struct name
  • label Standard unit label
  • m_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);