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) -> Sign
impl Copy for Sign
impl Debug for Sign
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Sign
fn default() -> Sign
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: &Sign) -> Ordering
impl PartialEq for Sign
fn eq(&self, other: &Sign) -> bool
impl PartialOrd for Sign
fn partial_cmp(&self, other: &Sign) -> Option<Ordering>
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
impl<T> Any for Sign
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Sign
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Sign
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Sign
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Sign
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Sign
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for Sign
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for Sign
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Sign
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Sign
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>