numaxiom 0.0.2

Lightweight numeric marker traits for ranges/signs plus constants and ops; std by default, no_std optional.
Documentation
use super::HasOne;

/// Provides the multiplicative identity (`1`) as a method.
pub trait One: HasOne {
    fn one() -> Self;
}

macro_rules! impl_one {
    ($($ty:ty),+ $(,)?) => {
        $(
            impl One for $ty {
                fn one() -> Self {
                    1 as $ty
                }
            }

        )+
    };
}

impl_one!(i8, i16, i32, i64, i128, isize);
impl_one!(u8, u16, u32, u64, u128, usize);
impl_one!(f32, f64);