Enum relp_num::NonZeroSign
source · 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 copy 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§fn eq(&self, other: &NonZeroSign) -> bool
fn eq(&self, other: &NonZeroSign) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for NonZeroSign
impl PartialOrd for NonZeroSign
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Signed for NonZeroSign
impl Signed for NonZeroSign
impl Copy for NonZeroSign
impl Eq for NonZeroSign
impl StructuralPartialEq for NonZeroSign
Auto Trait Implementations§
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> 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
.