[−][src]Enum time::Sign
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
A positive value.
A negative value.
A value that is exactly zero.
Methods
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]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Sign) -> Self::Output[src]
impl Div<Sign> for i16[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Sign) -> Self::Output[src]
impl Div<Sign> for i32[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Sign) -> Self::Output[src]
impl Div<Sign> for i64[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Sign) -> Self::Output[src]
impl Div<Sign> for i128[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Sign) -> Self::Output[src]
impl Div<Sign> for f32[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Sign) -> Self::Output[src]
impl Div<Sign> for f64[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Sign) -> Self::Output[src]
impl Div<Sign> for Sign[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Self) -> Self::Output[src]
impl DivAssign<Sign> for i8[src]
fn div_assign(&mut self, rhs: Sign)[src]
impl DivAssign<Sign> for i16[src]
fn div_assign(&mut self, rhs: Sign)[src]
impl DivAssign<Sign> for i32[src]
fn div_assign(&mut self, rhs: Sign)[src]
impl DivAssign<Sign> for i64[src]
fn div_assign(&mut self, rhs: Sign)[src]
impl DivAssign<Sign> for i128[src]
fn div_assign(&mut self, rhs: Sign)[src]
impl DivAssign<Sign> for f32[src]
fn div_assign(&mut self, rhs: Sign)[src]
impl DivAssign<Sign> for f64[src]
fn div_assign(&mut self, rhs: Sign)[src]
impl DivAssign<Sign> for Sign[src]
fn div_assign(&mut self, rhs: Self)[src]
impl Eq for Sign[src]
impl Hash for Sign[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Mul<Sign> for i8[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Sign) -> Self::Output[src]
impl Mul<Sign> for i16[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Sign) -> Self::Output[src]
impl Mul<Sign> for i32[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Sign) -> Self::Output[src]
impl Mul<Sign> for i64[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Sign) -> Self::Output[src]
impl Mul<Sign> for i128[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Sign) -> Self::Output[src]
impl Mul<Sign> for f32[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Sign) -> Self::Output[src]
impl Mul<Sign> for f64[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Sign) -> Self::Output[src]
impl Mul<Sign> for Sign[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Self) -> Self::Output[src]
impl Mul<f32> for Sign[src]
type Output = f32
The resulting type after applying the * operator.
fn mul(self, rhs: f32) -> Self::Output[src]
impl Mul<f64> for Sign[src]
type Output = f64
The resulting type after applying the * operator.
fn mul(self, rhs: f64) -> Self::Output[src]
impl Mul<i128> for Sign[src]
type Output = i128
The resulting type after applying the * operator.
fn mul(self, rhs: i128) -> Self::Output[src]
impl Mul<i16> for Sign[src]
type Output = i16
The resulting type after applying the * operator.
fn mul(self, rhs: i16) -> Self::Output[src]
impl Mul<i32> for Sign[src]
type Output = i32
The resulting type after applying the * operator.
fn mul(self, rhs: i32) -> Self::Output[src]
impl Mul<i64> for Sign[src]
type Output = i64
The resulting type after applying the * operator.
fn mul(self, rhs: i64) -> Self::Output[src]
impl Mul<i8> for Sign[src]
type Output = i8
The resulting type after applying the * operator.
fn mul(self, rhs: i8) -> Self::Output[src]
impl MulAssign<Sign> for i8[src]
fn mul_assign(&mut self, rhs: Sign)[src]
impl MulAssign<Sign> for i16[src]
fn mul_assign(&mut self, rhs: Sign)[src]
impl MulAssign<Sign> for i32[src]
fn mul_assign(&mut self, rhs: Sign)[src]
impl MulAssign<Sign> for i64[src]
fn mul_assign(&mut self, rhs: Sign)[src]
impl MulAssign<Sign> for i128[src]
fn mul_assign(&mut self, rhs: Sign)[src]
impl MulAssign<Sign> for f32[src]
fn mul_assign(&mut self, rhs: Sign)[src]
impl MulAssign<Sign> for f64[src]
fn mul_assign(&mut self, rhs: Sign)[src]
impl MulAssign<Sign> for Sign[src]
fn mul_assign(&mut self, rhs: Self)[src]
impl Neg for Sign[src]
type Output = Self
The resulting type after applying the - operator.
fn neg(self) -> Self::Output[src]
impl Not for Sign[src]
type Output = Self
The resulting type after applying the ! operator.
fn not(self) -> Self::Output[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,
fn borrow_mut(&mut self) -> &mut T[src]
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,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,