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
impl Copy for NonZeroSign
Source§impl Debug for NonZeroSign
impl Debug for NonZeroSign
impl Eq 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 Ord for NonZeroSign
Signs are totally ordered as Negative < Positive, matching the discriminants.
impl Ord for NonZeroSign
Signs are totally ordered as Negative < Positive, matching the discriminants.
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
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 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 UnsafeUnpin 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