pub trait Zero { fn is_zero(&self) -> bool; }
macro_rules! impl_dec_zero {
($($t:ty),*) => {$(
impl Zero for $t { #[inline(always)] fn is_zero(&self) -> bool { *self == 0 } }
)*}
}
impl_dec_zero!(usize, u8, u16, u32, u64,
isize, i8, i16, i32, i64);
impl Zero for f32 { fn is_zero(&self) -> bool { *self == 0. } }
impl Zero for f64 { fn is_zero(&self) -> bool { *self == 0. } }
impl Zero for char { fn is_zero(&self) -> bool { *self == '\0' } }
impl<T: ?Sized> Zero for *const T { fn is_zero(&self) -> bool { self.is_null() } }
impl<T: ?Sized> Zero for *mut T { fn is_zero(&self) -> bool { self.is_null() } }