Documentation
// Copyright (c) 2017, Marty Mills <daggerbot@gmail.com>
// This software is available under the terms of the zlib license.
// See COPYING.md for more information.

/// Returns zero.
pub trait Zero {
    fn zero () -> Self;
}

/// Returns one.
pub trait One {
    fn one () -> Self;
}

macro_rules! impl_zero_one_int {
    ($($ty:ty),*) => { $(
        impl Zero for $ty {
            #[inline(always)]
            fn zero () -> $ty { 0 }
        }

        impl One for $ty {
            #[inline(always)]
            fn one () -> $ty { 1 }
        }
    )* };
}

impl_zero_one_int!(i8, i16, i32, i64, isize, u8, u16, u32, u64, usize);