Enum time::Sign[][src]

#[repr(i8)]pub enum Sign {
    Positive,
    Negative,
    Zero,
}
👎 Deprecated since 0.2.7:

The only use for this (obtaining the sign of a Duration) can be replaced with Duration::is_{positive|negative|zero}

Contains the sign of a value: positive, negative, or zero.

For ease of use, Sign implements Mul and Div on all signed numeric types. Signs can also be multiplied and divided by another Sign, which follows the same rules as real numbers.

Variants

Positive
👎 Deprecated since 0.2.7:

The only use for this (obtaining the sign of a Duration) can be replaced with Duration::is_{positive|negative|zero}

A positive value.

Negative
👎 Deprecated since 0.2.7:

The only use for this (obtaining the sign of a Duration) can be replaced with Duration::is_{positive|negative|zero}

A negative value.

Zero
👎 Deprecated since 0.2.7:

The only use for this (obtaining the sign of a Duration) can be replaced with Duration::is_{positive|negative|zero}

A value that is exactly zero.

Implementations

impl Sign[src]

pub fn negate(self) -> Self[src]

Return the opposite of the current sign.

assert_eq!(Sign::Positive.negate(), Sign::Negative);
assert_eq!(Sign::Negative.negate(), Sign::Positive);
assert_eq!(Sign::Zero.negate(), Sign::Zero);

pub const fn is_positive(self) -> bool[src]

Is the sign positive?

assert!(Sign::Positive.is_positive());
assert!(!Sign::Negative.is_positive());
assert!(!Sign::Zero.is_positive());

pub const fn is_negative(self) -> bool[src]

Is the sign negative?

assert!(!Sign::Positive.is_negative());
assert!(Sign::Negative.is_negative());
assert!(!Sign::Zero.is_negative());

pub const fn is_zero(self) -> bool[src]

Is the value exactly zero?

assert!(!Sign::Positive.is_zero());
assert!(!Sign::Negative.is_zero());
assert!(Sign::Zero.is_zero());

Trait Implementations

impl Clone for Sign[src]

impl Copy for Sign[src]

impl Debug for Sign[src]

impl Default for Sign[src]

fn default() -> Self[src]

Sign defaults to Zero.

assert_eq!(Sign::default(), Sign::Zero);

impl Div<Sign> for Sign[src]

type Output = Self

The resulting type after applying the / operator.

impl DivAssign<Sign> for Sign[src]

impl Eq for Sign[src]

impl Hash for Sign[src]

impl Mul<Sign> for Sign[src]

type Output = Self

The resulting type after applying the * operator.

impl Mul<f32> for Sign[src]

type Output = f32

The resulting type after applying the * operator.

impl Mul<f64> for Sign[src]

type Output = f64

The resulting type after applying the * operator.

impl Mul<i128> for Sign[src]

type Output = i128

The resulting type after applying the * operator.

impl Mul<i16> for Sign[src]

type Output = i16

The resulting type after applying the * operator.

impl Mul<i32> for Sign[src]

type Output = i32

The resulting type after applying the * operator.

impl Mul<i64> for Sign[src]

type Output = i64

The resulting type after applying the * operator.

impl Mul<i8> for Sign[src]

type Output = i8

The resulting type after applying the * operator.

impl MulAssign<Sign> for Sign[src]

impl Neg for Sign[src]

type Output = Self

The resulting type after applying the - operator.

impl Not for Sign[src]

type Output = Self

The resulting type after applying the ! operator.

impl PartialEq<Sign> for Sign[src]

impl StructuralEq for Sign[src]

impl StructuralPartialEq for Sign[src]

Auto Trait Implementations

impl RefUnwindSafe for Sign

impl Send for Sign

impl Sync for Sign

impl Unpin for Sign

impl UnwindSafe for Sign

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.