Enum Sign
#[repr(i8)]
pub enum Sign
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
-
Zero = 0 -
Positive = 1 -
Negative = -1
Implementations
impl Sign
const fn is_zero(self) -> boolReturns true when the sign is
Sign::Zero.const fn is_positive(self) -> boolReturns true when the sign is
Sign::Positive.const fn is_negative(self) -> boolReturns true when the sign is
Sign::Negative.const fn signum(self) -> i8Returns the sign as an
i8.This is guaranteed to be
-1,0or1.const fn as_i8(self) -> i8Returns the sign as an
i8.This is guaranteed to be
-1,0or1.const fn as_i16(self) -> i16Returns the sign as an
i16.This is guaranteed to be
-1,0or1.const fn as_i32(self) -> i32Returns the sign as an
i32.This is guaranteed to be
-1,0or1.const fn as_i64(self) -> i64Returns the sign as an
i64.This is guaranteed to be
-1,0or1.const fn as_i128(self) -> i128Returns the sign as an
i128.This is guaranteed to be
-1,0or1.fn from_ordinals<T: Ord>(t1: T, t2: T) -> SignReturns a
Signas a result of comparing two values.- When
t1 < t2, returnsSign::Negative. - When
t1 == t2, returnsSign::Zero. - When
t1 > t2, returnsSign::Positive.
- When
Trait Implementations
impl Clone for Sign
fn clone(&self) -> Self
impl Copy for Sign
impl Debug for Sign
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Sign
fn default() -> Self
impl Display for Sign
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Sign
impl From<f64> for Sign
fn from(n: f64) -> Sign
impl From<i128> for Sign
fn from(n: i128) -> Sign
impl From<i16> for Sign
fn from(n: i16) -> Sign
impl From<i32> for Sign
fn from(n: i32) -> Sign
impl From<i64> for Sign
fn from(n: i64) -> Sign
impl From<i8> for Sign
fn from(n: i8) -> Sign
impl Hash for Sign
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Mul for Sign
type Output = Sign;fn mul(self, rhs: Sign) -> Sign
impl Mul<i128> for Sign
type Output = i128;fn mul(self, n: i128) -> i128
impl Mul<i16> for Sign
type Output = i16;fn mul(self, n: i16) -> i16
impl Mul<i32> for Sign
type Output = i32;fn mul(self, n: i32) -> i32
impl Mul<i64> for Sign
type Output = i64;fn mul(self, n: i64) -> i64
impl Mul<i8> for Sign
type Output = i8;fn mul(self, n: i8) -> i8
impl Neg for Sign
type Output = Sign;fn neg(self) -> Sign
impl Ord for Sign
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for Sign
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Sign
fn partial_cmp(&self, other: &Self) -> Option<Ordering>