use super::HasOne;
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);