Trait DurationExt

Source
pub trait DurationExt: Sized {
    // Required methods
    fn as_millis(&self) -> Option<u64>;
    fn mul_u64(&self, rhs: u64) -> Option<Self>;
    fn div_u64(&self, rhs: u64) -> Option<Self>;
}
Expand description

Extensions to the Duration type.

Required Methods§

Source

fn as_millis(&self) -> Option<u64>

Returns the number of whole milliseconds contained in this Duration.

Returns None if the value exceeds the capacity of a u64.

Source

fn mul_u64(&self, rhs: u64) -> Option<Self>

Multiplies this Duration.

Like the Mul implementation for Duration, except that it takes a u64 instead of a `u32.

Source

fn div_u64(&self, rhs: u64) -> Option<Self>

Divides this Duration.

Like the Div implementation for Duration, except that it takes a u64 instead of a u32.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl DurationExt for Duration

Source§

fn as_millis(&self) -> Option<u64>

Source§

fn mul_u64(&self, rhs: u64) -> Option<Duration>

Source§

fn div_u64(&self, rhs: u64) -> Option<Duration>

Implementors§