#[repr(i8)]
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}
Expand description
Variants
Positive
The only use for this (obtaining the sign of a Duration
) can be replaced with Duration::is_{positive|negative|zero}
A positive value.
Negative
The only use for this (obtaining the sign of a Duration
) can be replaced with Duration::is_{positive|negative|zero}
A negative value.
Zero
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
sourceimpl Sign
impl Sign
sourcepub fn negate(self) -> Self
pub fn negate(self) -> Self
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);
sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Is the sign positive?
assert!(Sign::Positive.is_positive());
assert!(!Sign::Negative.is_positive());
assert!(!Sign::Zero.is_positive());
sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Is the sign negative?
assert!(!Sign::Positive.is_negative());
assert!(Sign::Negative.is_negative());
assert!(!Sign::Zero.is_negative());
Trait Implementations
sourceimpl DivAssign<Sign> for i8
impl DivAssign<Sign> for i8
sourcefn div_assign(&mut self, rhs: Sign)
fn div_assign(&mut self, rhs: Sign)
Performs the /=
operation. Read more
sourceimpl DivAssign<Sign> for i16
impl DivAssign<Sign> for i16
sourcefn div_assign(&mut self, rhs: Sign)
fn div_assign(&mut self, rhs: Sign)
Performs the /=
operation. Read more
sourceimpl DivAssign<Sign> for i32
impl DivAssign<Sign> for i32
sourcefn div_assign(&mut self, rhs: Sign)
fn div_assign(&mut self, rhs: Sign)
Performs the /=
operation. Read more
sourceimpl DivAssign<Sign> for i64
impl DivAssign<Sign> for i64
sourcefn div_assign(&mut self, rhs: Sign)
fn div_assign(&mut self, rhs: Sign)
Performs the /=
operation. Read more
sourceimpl DivAssign<Sign> for i128
impl DivAssign<Sign> for i128
sourcefn div_assign(&mut self, rhs: Sign)
fn div_assign(&mut self, rhs: Sign)
Performs the /=
operation. Read more
sourceimpl DivAssign<Sign> for f32
impl DivAssign<Sign> for f32
sourcefn div_assign(&mut self, rhs: Sign)
fn div_assign(&mut self, rhs: Sign)
Performs the /=
operation. Read more
sourceimpl DivAssign<Sign> for f64
impl DivAssign<Sign> for f64
sourcefn div_assign(&mut self, rhs: Sign)
fn div_assign(&mut self, rhs: Sign)
Performs the /=
operation. Read more
sourceimpl DivAssign<Sign> for Sign
impl DivAssign<Sign> for Sign
sourcefn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the /=
operation. Read more
sourceimpl MulAssign<Sign> for i8
impl MulAssign<Sign> for i8
sourcefn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the *=
operation. Read more
sourceimpl MulAssign<Sign> for i16
impl MulAssign<Sign> for i16
sourcefn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the *=
operation. Read more
sourceimpl MulAssign<Sign> for i32
impl MulAssign<Sign> for i32
sourcefn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the *=
operation. Read more
sourceimpl MulAssign<Sign> for i64
impl MulAssign<Sign> for i64
sourcefn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the *=
operation. Read more
sourceimpl MulAssign<Sign> for i128
impl MulAssign<Sign> for i128
sourcefn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the *=
operation. Read more
sourceimpl MulAssign<Sign> for f32
impl MulAssign<Sign> for f32
sourcefn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the *=
operation. Read more
sourceimpl MulAssign<Sign> for f64
impl MulAssign<Sign> for f64
sourcefn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the *=
operation. Read more
sourceimpl MulAssign<Sign> for Sign
impl MulAssign<Sign> for Sign
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the *=
operation. Read more
impl Copy for Sign
impl Eq for Sign
impl StructuralEq for Sign
impl StructuralPartialEq for Sign
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more