abs_diff(_self, other) | Computes the absolute difference between `self` and `other`. # Examples ``` use std::time::Duration; assert_eq!(Duration::new(100, 0).abs_diff(Duration::new(80, 0)), Duration::new(20, 0)); assert_eq!(Duration::new(100, 400_000_000).abs_diff(Duration::new(110, 0)), Duration::new(9, 600_000_000)); ` |
add(_self, rhs) | No Documentation 🚧 |
as_micros(_self) | Returns the total number of whole microseconds contained by this `Duration`. # Examples ``` use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_micros(), 5_730_023); ` |
as_millis(_self) | Returns the total number of whole milliseconds contained by this `Duration`. # Examples ``` use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_millis(), 5_730); ``` |
as_nanos(_self) | Returns the total number of nanoseconds contained by this `Duration`. # Examples ``` use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_nanos(), 5_730_023_852); ``` |
as_secs(_self) | Returns the number of _whole_ seconds contained by this `Duration`. The returned value does not in |
as_secs_f32(_self) | Returns the number of seconds contained by this `Duration` as `f32`. The returned value includes t |
as_secs_f64(_self) | Returns the number of seconds contained by this `Duration` as `f64`. The returned value includes t |
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
div(_self, rhs) | No Documentation 🚧 |
div_duration_f32(_self, rhs) | Divides `Duration` by `Duration` and returns `f32`. # Examples ``` use std::time::Duration; let dur1 = Duration::new(2, 700_000_000); let dur2 = Duration::new(5, 400_000_000); assert_eq!(dur1.div_duration_f32(dur2), 0.5); ``` |
div_duration_f64(_self, rhs) | Divides `Duration` by `Duration` and returns `f64`. # Examples ``` use std::time::Duration; let dur1 = Duration::new(2, 700_000_000); let dur2 = Duration::new(5, 400_000_000); assert_eq!(dur1.div_duration_f64(dur2), 0.5); ``` |
div_f32(_self, rhs) | Divides `Duration` by `f32`. # Panics This method will panic if result is negative, overflows `Duration` |
div_f64(_self, rhs) | Divides `Duration` by `f64`. # Panics This method will panic if result is negative, overflows `Duration` |
eq(_self, other) | No Documentation 🚧 |
from_micros(micros) | Creates a new `Duration` from the specified number of microseconds. # Examples ``` use std::time::Duration; let duration = Duration::from_micros(1_000_002); assert_eq!(1, duration.as_secs()); assert_eq!(2_000, duration.subsec_nanos()); ` |
from_millis(millis) | Creates a new `Duration` from the specified number of milliseconds. # Examples ``` use std::time::Duration; let duration = Duration::from_millis(2_569); assert_eq!(2, duration.as_secs()); assert_eq!(569_000_000, duration.subsec_nanos()); ` |
from_nanos(nanos) | Creates a new `Duration` from the specified number of nanoseconds. Note: Using this on the return |
from_secs(secs) | Creates a new `Duration` from the specified number of whole seconds. # Examples ``` use std::time::Duration; let duration = Duration::from_secs(5); assert_eq!(5, duration.as_secs()); assert_eq!(0, duration.subsec_nanos()); ``` |
from_secs_f32(secs) | Creates a new `Duration` from the specified number of seconds represented as `f32`. # Panics Thi |
from_secs_f64(secs) | Creates a new `Duration` from the specified number of seconds represented as `f64`. # Panics Thi |
is_zero(_self) | Returns true if this `Duration` spans no time. # Examples ``` use std::time::Duration; assert!(Duration::ZERO.is_zero()); assert!(Duration::new(0, 0).is_zero()); assert!(Duration::from_nanos(0).is_zero()); assert!(Duration::from_secs(0).is_zero()); assert!(!Duration::new(1, 1).is_zero()); assert!(!Duration::from_nanos(1).is_zero()); assert!(!Duration::from_secs(1).is_zero()); ``` |
mul(_self, rhs) | No Documentation 🚧 |
mul_f32(_self, rhs) | Multiplies `Duration` by `f32`. # Panics This method will panic if result is negative, overflows `Duration` |
mul_f64(_self, rhs) | Multiplies `Duration` by `f64`. # Panics This method will panic if result is negative, overflows `Duration` |
new(secs, nanos) | Creates a new `Duration` from the specified number of whole seconds and additional nanoseconds. I |
saturating_add(_self, rhs) | Saturating `Duration` addition. Computes `self + other`, returning [`Duration::MAX`] if overflow occurred. # Examples ``` #![feature(duration_constants)] |
saturating_mul(_self, rhs) | Saturating `Duration` multiplication. Computes `self * other`, returning [`Duration::MAX`] if overflow occurred. # Examples ``` #![feature(duration_constants)] use std::time::Duration; assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2)); assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX); ``` |
saturating_sub(_self, rhs) | Saturating `Duration` subtraction. Computes `self - other`, returning [`Duration::ZERO`] if the result would be negative or if overflow occurred. # Examples ``` use std::time::Duration; assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1)); assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO); ``` |
sub(_self, rhs) | No Documentation 🚧 |
subsec_micros(_self) | Returns the fractional part of this `Duration`, in whole microseconds. This method does **not** re |
subsec_millis(_self) | Returns the fractional part of this `Duration`, in whole milliseconds. This method does **not** re |
subsec_nanos(_self) | Returns the fractional part of this `Duration`, in nanoseconds. This method does **not** return th |