Enum time::Sign [−][src]
pub enum Sign { Positive, Negative, Zero, }
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. Sign
s can also be multiplied and divided by another Sign
, which
follows the same rules as real numbers.
Variants
The only use for this (obtaining the sign of a Duration
) can be replaced with Duration::is_{positive|negative|zero}
A positive value.
The only use for this (obtaining the sign of a Duration
) can be replaced with Duration::is_{positive|negative|zero}
A negative value.
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][+]
impl Div<Sign> for i8
[src][+]
impl Div<Sign> for i16
[src][+]
impl Div<Sign> for i32
[src][+]
impl Div<Sign> for i64
[src][+]
impl Div<Sign> for i128
[src][+]
impl Div<Sign> for f32
[src][+]
impl Div<Sign> for f64
[src][+]
impl Div<Sign> for Sign
[src][+]
impl DivAssign<Sign> for i8
[src][+]
impl DivAssign<Sign> for i16
[src][+]
impl DivAssign<Sign> for i32
[src][+]
impl DivAssign<Sign> for i64
[src][+]
impl DivAssign<Sign> for i128
[src][+]
impl DivAssign<Sign> for f32
[src][+]
impl DivAssign<Sign> for f64
[src][+]
impl DivAssign<Sign> for Sign
[src][+]
impl Eq for Sign
[src]
impl Hash for Sign
[src][+]
impl Mul<Sign> for i8
[src][+]
impl Mul<Sign> for i16
[src][+]
impl Mul<Sign> for i32
[src][+]
impl Mul<Sign> for i64
[src][+]
impl Mul<Sign> for i128
[src][+]
impl Mul<Sign> for f32
[src][+]
impl Mul<Sign> for f64
[src][+]
impl Mul<Sign> for Sign
[src][+]
impl Mul<f32> for Sign
[src][+]
impl Mul<f64> for Sign
[src][+]
impl Mul<i128> for Sign
[src][+]
impl Mul<i16> for Sign
[src][+]
impl Mul<i32> for Sign
[src][+]
impl Mul<i64> for Sign
[src][+]
impl Mul<i8> for Sign
[src][+]
impl MulAssign<Sign> for i8
[src][+]
impl MulAssign<Sign> for i16
[src][+]
impl MulAssign<Sign> for i32
[src][+]
impl MulAssign<Sign> for i64
[src][+]
impl MulAssign<Sign> for i128
[src][+]
impl MulAssign<Sign> for f32
[src][+]
impl MulAssign<Sign> for f64
[src][+]
impl MulAssign<Sign> for Sign
[src][+]
impl Neg for Sign
[src][+]
impl Not for Sign
[src][+]
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][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,