Add Zero::is_nonzero.
This commit is contained in:
parent
aa36cdb206
commit
b0ffbf317a
|
@ -23,6 +23,12 @@ pub trait Zero: Sized + Add<Self, Output = Self> {
|
||||||
/// Returns `true` if `self` is equal to the additive identity.
|
/// Returns `true` if `self` is equal to the additive identity.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_zero(&self) -> bool;
|
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 {
|
macro_rules! zero_impl {
|
||||||
|
|
Loading…
Reference in New Issue