tempa 0.1.17

A no_std temporal system for animation and simulation, providing time, duration, time ranges, frame rates, and deterministic frame-index stepping.
Documentation
macro_rules! impl_numeric_zero {
    ($wrapper:ident<$t:ident>) => {
        // Zero inherent
        impl<$t> $wrapper<$t>
        where
            $t: ::rinia::numeric::Zero,
        {
            /// Returns the zero.
            pub const ZERO: Self = Self(<$t as ::rinia::numeric::Zero>::ZERO);
        }

        // Zero trait
        impl<$t> ::rinia::numeric::Zero for $wrapper<$t>
        where
            $t: ::rinia::numeric::Zero,
        {
            const ZERO: Self = $wrapper::ZERO;
        }
    };
}

macro_rules! impl_numeric_bounded_min {
    ($wrapper:ident<$t:ident>) => {
        // BoundedMin inherent
        impl<$t> $wrapper<$t>
        where
            $t: ::rinia::numeric::BoundedMin,
        {
            /// Returns the minimum value.
            pub const MIN: Self = Self(<$t as ::rinia::numeric::BoundedMin>::MIN);
        }

        // BoundedMin trait
        impl<$t> ::rinia::numeric::BoundedMin for $wrapper<$t>
        where
            $t: ::rinia::numeric::BoundedMin,
        {
            const MIN: Self = $wrapper::MIN;
        }
    };
}

macro_rules! impl_numeric_bounded_max {
    ($wrapper:ident<$t:ident>) => {
        // BoundedMax inherent
        impl<$t> $wrapper<$t>
        where
            $t: ::rinia::numeric::BoundedMax,
        {
            /// Returns the maximum value.
            pub const MAX: Self = Self(<$t as ::rinia::numeric::BoundedMax>::MAX);
        }

        // BoundedMax trait
        impl<$t> ::rinia::numeric::BoundedMax for $wrapper<$t>
        where
            $t: ::rinia::numeric::BoundedMax,
        {
            const MAX: Self = $wrapper::MAX;
        }
    };
}

macro_rules! impl_numeric_min_max {
    ($wrapper:ident<$t:ident>) => {
        // MinMax inherent
        impl<$t> $wrapper<$t>
        where
            $t: ::rinia::numeric::MinMax,
        {
            /// Returns the minimum of two values.
            pub fn min(self, other: Self) -> Self {
                Self(<$t as ::rinia::numeric::MinMax>::minimum(self.0, other.0))
            }

            /// Returns the maximum of two values.
            pub fn max(self, other: Self) -> Self {
                Self(<$t as ::rinia::numeric::MinMax>::maximum(self.0, other.0))
            }
        }

        // MinMax trait
        impl<$t> ::rinia::numeric::MinMax for $wrapper<$t>
        where
            $t: ::rinia::numeric::MinMax,
        {
            fn minimum(self, other: Self) -> Self {
                $wrapper::min(self, other)
            }

            fn maximum(self, other: Self) -> Self {
                $wrapper::max(self, other)
            }
        }
    };
}

macro_rules! impl_numeric_is_finite {
    ($wrapper:ident<$t:ident>) => {
        // IsFinite inherent
        impl<$t> $wrapper<$t>
        where
            $t: Copy + ::rinia::numeric::IsFinite,
        {
            /// Returns true if the value is finite.
            pub fn is_finite(self) -> bool {
                <$t as ::rinia::numeric::IsFinite>::is_finite(self.0)
            }
        }

        // IsFinite trait
        impl<$t> ::rinia::numeric::IsFinite for $wrapper<$t>
        where
            $t: Copy + ::rinia::numeric::IsFinite,
        {
            fn is_finite(self) -> bool {
                $wrapper::is_finite(self)
            }
        }
    };
}

pub(crate) use impl_numeric_bounded_max;
pub(crate) use impl_numeric_bounded_min;
pub(crate) use impl_numeric_is_finite;
pub(crate) use impl_numeric_min_max;
pub(crate) use impl_numeric_zero;