pub struct Time(/* private fields */);
Expand description
A newtype for the concept of time.
A Time
value can represent either a point in time
or the output of arithmetic involving time.
Wraps f64
.
§Examples
let t0 = tskit::Time::from(2.0);
let t1 = tskit::Time::from(10.0);
let mut sum = t0 + t1;
match sum.partial_cmp(&12.0) {
Some(std::cmp::Ordering::Equal) => (),
_ => assert!(false),
};
sum /= tskit::Time::from(2.0);
match sum.partial_cmp(&6.0) {
Some(std::cmp::Ordering::Equal) => (),
_ => assert!(false),
};
§Notes
The current implementation of PartialOrd
is based on
the underlying implementation for f64
.
A Time
can be multiplied and divided by a Position
Trait Implementations§
Source§impl AddAssign for Time
impl AddAssign for Time
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl DivAssign<Position> for Time
impl DivAssign<Position> for Time
Source§fn div_assign(&mut self, other: Position)
fn div_assign(&mut self, other: Position)
Performs the
/=
operation. Read moreSource§impl DivAssign<Time> for Position
impl DivAssign<Time> for Position
Source§fn div_assign(&mut self, other: Time)
fn div_assign(&mut self, other: Time)
Performs the
/=
operation. Read moreSource§impl DivAssign for Time
impl DivAssign for Time
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/=
operation. Read moreSource§impl MulAssign<Position> for Time
impl MulAssign<Position> for Time
Source§fn mul_assign(&mut self, other: Position)
fn mul_assign(&mut self, other: Position)
Performs the
*=
operation. Read moreSource§impl MulAssign<Time> for Position
impl MulAssign<Time> for Position
Source§fn mul_assign(&mut self, other: Time)
fn mul_assign(&mut self, other: Time)
Performs the
*=
operation. Read moreSource§impl MulAssign for Time
impl MulAssign for Time
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreSource§impl PartialOrd<Time> for f64
impl PartialOrd<Time> for f64
Source§impl PartialOrd<f64> for Time
impl PartialOrd<f64> for Time
Source§impl PartialOrd for Time
impl PartialOrd for Time
Source§impl SubAssign for Time
impl SubAssign for Time
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl Copy for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more