pub struct Duration { /* private fields */ }Expand description
Duration is an interval of time
Durations can handle lengths of time about 40 times as long as the age of the universe, and have attosecond (10^-18) precision.
Negative values are supported.
Stored in 128 bits.
Implementations§
Source§impl Duration
impl Duration
Sourcepub const fn new(secs: i64, attos: i64) -> Self
pub const fn new(secs: i64, attos: i64) -> Self
Make a new Duration with given number of seconds and attoseconds.
Sourcepub const fn from_seconds(secs: f64) -> Self
pub const fn from_seconds(secs: f64) -> Self
Make a new Duration from seconds as f64.
Sourcepub const fn seconds_part(&self) -> i64
pub const fn seconds_part(&self) -> i64
The seconds part
Sourcepub const fn attos_part(&self) -> i64
pub const fn attos_part(&self) -> i64
The sub-second attoseconds part
Trait Implementations§
Source§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+= operation. Read moreSource§impl AddAssign for Duration
impl AddAssign for Duration
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl Ord for Duration
impl Ord for Duration
Source§impl PartialOrd for Duration
impl PartialOrd for Duration
Source§impl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
Source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
Performs the
-= operation. Read moreSource§impl SubAssign for Duration
impl SubAssign for Duration
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Duration
impl Eq for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
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