absolute_unit/unit/
miles.rs1use crate::{LengthUnit, Unit};
2
3#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
6pub struct Miles;
7impl Unit for Miles {
8 const UNIT_NAME: &'static str = "miles";
9 const UNIT_SHORT_NAME: &'static str = "miles";
10 const UNIT_SUFFIX: &'static str = "miles";
11}
12impl LengthUnit for Miles {
13 const METERS_IN_UNIT: f64 = 1609.34;
14}
15
16#[macro_export]
17macro_rules! miles {
18 ($num:expr) => {
19 $crate::Length::<$crate::Miles>::from(&$num)
20 };
21}
22
23#[macro_export]
24macro_rules! miles_per_hour {
25 ($num:expr) => {
26 $crate::Velocity::<$crate::Miles, $crate::Hours>::from(&$num)
27 };
28}