pub enum NonZeroSign {
Positive = 1,
Negative = -1,
}
Expand description
Sign of a nonzero value.
Existing Sign
traits, such in num
, typically have a third value for the sign of 0. Working
with that trait creates many branches or match cases that should never be possible.
Variants§
Trait Implementations§
Source§impl Clone for NonZeroSign
impl Clone for NonZeroSign
Source§fn clone(&self) -> NonZeroSign
fn clone(&self) -> NonZeroSign
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for NonZeroSign
impl Debug for NonZeroSign
Source§impl From<NonZeroSign> for Sign
impl From<NonZeroSign> for Sign
Source§fn from(sign: NonZeroSign) -> Self
fn from(sign: NonZeroSign) -> Self
Converts to this type from the input type.
Source§impl From<Sign> for NonZeroSign
impl From<Sign> for NonZeroSign
Source§impl Mul for NonZeroSign
impl Mul for NonZeroSign
Source§impl MulAssign for NonZeroSign
impl MulAssign for NonZeroSign
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreSource§impl Neg for NonZeroSign
impl Neg for NonZeroSign
Source§impl Negateable for NonZeroSign
impl Negateable for NonZeroSign
Source§impl NonZero for NonZeroSign
impl NonZero for NonZeroSign
Source§fn is_not_zero(&self) -> bool
fn is_not_zero(&self) -> bool
Whether the value is not equal to zero. Read more
Source§impl Not for NonZeroSign
impl Not for NonZeroSign
Source§impl PartialEq for NonZeroSign
impl PartialEq for NonZeroSign
Source§impl PartialOrd for NonZeroSign
impl PartialOrd for NonZeroSign
Source§impl Signed for NonZeroSign
impl Signed for NonZeroSign
impl Copy for NonZeroSign
impl Eq for NonZeroSign
impl StructuralPartialEq for NonZeroSign
Auto Trait Implementations§
impl Freeze for NonZeroSign
impl RefUnwindSafe for NonZeroSign
impl Send for NonZeroSign
impl Sync for NonZeroSign
impl Unpin for NonZeroSign
impl UnwindSafe for NonZeroSign
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> NonZeroSigned for T
impl<T> NonZeroSigned for T
Source§fn non_zero_signum(&self) -> NonZeroSign
fn non_zero_signum(&self) -> NonZeroSign
Whether the value is positive or negative.
Source§fn non_zero_is_positive(&self) -> bool
fn non_zero_is_positive(&self) -> bool
Whether
x > 0
.Source§fn non_zero_is_negative(&self) -> bool
fn non_zero_is_negative(&self) -> bool
Whether
x < 0
.