Add Zero::is_nonzero.

This commit is contained in:
Clar Charr 2018-03-05 16:25:47 -05:00
parent aa36cdb206
commit b0ffbf317a
1 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,12 @@ pub trait Zero: Sized + Add<Self, Output = Self> {
/// Returns `true` if `self` is equal to the additive identity.
#[inline]
fn is_zero(&self) -> bool;
/// Returns `true` if `self` is not equal to the additive identity.
#[inline]
fn is_nonzero(&self) -> bool {
!self.is_zero()
}
}
macro_rules! zero_impl {