#[repr(i8)]pub enum Sign {
Zero = 0,
Positive = 1,
Negative = -1,
}Expand description
A representation of a numeric sign.
Its Display impl emits the ASCII minus sign, -, when this is negative.
It emits the empty string in all other cases.
Variants§
Implementations§
Source§impl Sign
impl Sign
Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Returns true when the sign is Sign::Positive.
Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Returns true when the sign is Sign::Negative.
Sourcepub const fn signum(self) -> i8
pub const fn signum(self) -> i8
Returns the sign as an i8.
This is guaranteed to be -1, 0 or 1.
Sourcepub const fn as_i16(self) -> i16
pub const fn as_i16(self) -> i16
Returns the sign as an i16.
This is guaranteed to be -1, 0 or 1.
Sourcepub const fn as_i32(self) -> i32
pub const fn as_i32(self) -> i32
Returns the sign as an i32.
This is guaranteed to be -1, 0 or 1.
Sourcepub const fn as_i64(self) -> i64
pub const fn as_i64(self) -> i64
Returns the sign as an i64.
This is guaranteed to be -1, 0 or 1.
Sourcepub const fn as_i128(self) -> i128
pub const fn as_i128(self) -> i128
Returns the sign as an i128.
This is guaranteed to be -1, 0 or 1.
Sourcepub fn from_ordinals<T: Ord>(t1: T, t2: T) -> Sign
pub fn from_ordinals<T: Ord>(t1: T, t2: T) -> Sign
Returns a Sign as a result of comparing two values.
- When
t1 < t2, returnsSign::Negative. - When
t1 == t2, returnsSign::Zero. - When
t1 > t2, returnsSign::Positive.
Trait Implementations§
impl Copy for Sign
impl Eq for Sign
Source§impl From<f64> for Sign
This considers NaN values as having a zero sign.
impl From<f64> for Sign
This considers NaN values as having a zero sign.
In general, Jiff having a NaN value in memory is a bug.
Source§impl Ord for Sign
impl Ord for Sign
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
Source§impl PartialOrd for Sign
impl PartialOrd for Sign
impl StructuralPartialEq for Sign
Auto Trait Implementations§
impl Freeze for Sign
impl RefUnwindSafe for Sign
impl Send for Sign
impl Sync for Sign
impl Unpin for Sign
impl UnsafeUnpin for Sign
impl UnwindSafe for Sign
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