use crate::{duration::units::*, frequency::units::*, time_int::TimeInt};
pub trait NumericConstructor: TimeInt {
fn nanoseconds(self) -> Nanoseconds<Self>;
fn microseconds(self) -> Microseconds<Self>;
fn milliseconds(self) -> Milliseconds<Self>;
fn seconds(self) -> Seconds<Self>;
fn minutes(self) -> Minutes<Self>;
fn hours(self) -> Hours<Self>;
fn hertz(self) -> Hertz<Self>;
}
macro_rules! impl_numeric_constructors {
($($type:ty),* $(,)?) => {
$(
impl NumericConstructor for $type {
#[inline(always)]
fn nanoseconds(self) -> Nanoseconds<$type> {
Nanoseconds(self)
}
#[inline(always)]
fn microseconds(self) -> Microseconds<$type> {
Microseconds(self)
}
#[inline(always)]
fn milliseconds(self) -> Milliseconds<$type> {
Milliseconds(self)
}
#[inline(always)]
fn seconds(self) -> Seconds<$type> {
Seconds(self)
}
#[inline(always)]
fn minutes(self) -> Minutes<$type> {
Minutes(self)
}
#[inline(always)]
fn hours(self) -> Hours<$type> {
Hours(self)
}
#[inline(always)]
fn hertz(self) -> Hertz<$type> {
Hertz(self)
}
}
)*
};
}
impl_numeric_constructors![u32, u64];