Struct jormungandr_lib::time::Duration
source · pub struct Duration(Duration);
Expand description
Length of time between 2 events.
Example
let duration = Duration::new(9289, 200000000);
println!("started: {}", duration);
// started: 2h 34m 49s 200ms
Tuple Fields§
§0: Duration
Implementations§
source§impl Duration
impl Duration
pub fn new(secs: u64, nanos: u32) -> Self
pub fn as_secs(&self) -> u64
pub fn as_secs_f64(&self) -> f64
pub fn as_millis(&self) -> u128
pub fn as_micro(&self) -> u128
pub fn as_nanos(&self) -> u128
pub fn from_millis(millis: u64) -> Self
pub fn checked_add(self, rhs: Duration) -> Option<Duration>
pub fn checked_sub(self, rhs: Duration) -> Option<Duration>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Duration
impl<'de> Deserialize<'de> for Duration
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Duration
impl Ord for Duration
source§impl PartialEq<Duration> for Duration
impl PartialEq<Duration> for Duration
source§impl PartialOrd<Duration> for Duration
impl PartialOrd<Duration> for Duration
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Duration
impl Eq for Duration
impl StructuralEq for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
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