[−][src]Enum time::Sign
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
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<'a> Deserialize<'a> for Sign[src]
pub fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'a>, [src]
D: Deserializer<'a>,
impl Div<Sign> for Sign[src]
type Output = Self
The resulting type after applying the / operator.
pub fn div(self, rhs: Self) -> Self::Output[src]
impl DivAssign<Sign> for Sign[src]
pub fn div_assign(&mut self, rhs: Self)[src]
impl Eq for Sign[src]
impl Hash for Sign[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Mul<Sign> for Sign[src]
type Output = Self
The resulting type after applying the * operator.
pub fn mul(self, rhs: Self) -> Self::Output[src]
impl Mul<f32> for Sign[src]
type Output = f32
The resulting type after applying the * operator.
pub fn mul(self, rhs: f32) -> Self::Output[src]
impl Mul<f64> for Sign[src]
type Output = f64
The resulting type after applying the * operator.
pub fn mul(self, rhs: f64) -> Self::Output[src]
impl Mul<i128> for Sign[src]
type Output = i128
The resulting type after applying the * operator.
pub fn mul(self, rhs: i128) -> Self::Output[src]
impl Mul<i16> for Sign[src]
type Output = i16
The resulting type after applying the * operator.
pub fn mul(self, rhs: i16) -> Self::Output[src]
impl Mul<i32> for Sign[src]
type Output = i32
The resulting type after applying the * operator.
pub fn mul(self, rhs: i32) -> Self::Output[src]
impl Mul<i64> for Sign[src]
type Output = i64
The resulting type after applying the * operator.
pub fn mul(self, rhs: i64) -> Self::Output[src]
impl Mul<i8> for Sign[src]
type Output = i8
The resulting type after applying the * operator.
pub fn mul(self, rhs: i8) -> Self::Output[src]
impl MulAssign<Sign> for Sign[src]
pub fn mul_assign(&mut self, rhs: Self)[src]
impl Neg for Sign[src]
type Output = Self
The resulting type after applying the - operator.
pub fn neg(self) -> Self::Output[src]
impl Not for Sign[src]
type Output = Self
The resulting type after applying the ! operator.
pub fn not(self) -> Self::Output[src]
impl PartialEq<Sign> for Sign[src]
pub fn eq(&self, other: &Sign) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl Serialize for Sign[src]
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructuralEq for Sign[src]
impl StructuralPartialEq for Sign[src]
Auto Trait Implementations
impl RefUnwindSafe for Sign[src]
impl Send for Sign[src]
impl Sync for Sign[src]
impl Unpin for Sign[src]
impl UnwindSafe for Sign[src]
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,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
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.
pub fn to_owned(&self) -> T[src]
pub 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.
pub 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,