[][src]Struct coarsetime::Duration

pub struct Duration(_);

A duration type to represent an approximate span of time

Methods

impl Duration[src]

pub fn new(sec: u64, nanos: u32) -> Duration[src]

Creates a new Duration from the specified number of seconds and additional nanosecond precision

pub fn from_secs(sec: u64) -> Duration[src]

Creates a new Duration from the specified number of seconds

pub fn from_millis(millis: u64) -> Duration[src]

Creates a new Duration from the specified number of milliseconds

pub fn as_secs(&self) -> u64[src]

Returns the number of whole seconds represented by this duration

pub fn subsec_nanos(&self) -> u32[src]

Returns the nanosecond precision represented by this duration

pub fn as_f64(&self) -> f64[src]

Returns the duration as a floating point number, representing the number of seconds

Trait Implementations

impl Into<Duration> for Duration[src]

impl PartialOrd<Duration> for Duration[src]

impl Copy for Duration[src]

impl PartialEq<Duration> for Duration[src]

impl Default for Duration[src]

impl From<Duration> for Duration[src]

impl Clone for Duration[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for Duration[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more

impl Eq for Duration[src]

impl Debug for Duration[src]

impl Sub<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the - operator.

impl Sub<Duration> for Instant[src]

type Output = Instant

The resulting type after applying the - operator.

impl Hash for Duration[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Add<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the + operator.

impl Add<Duration> for Instant[src]

type Output = Instant

The resulting type after applying the + operator.

impl Mul<u32> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Div<u32> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl AddAssign<Duration> for Duration[src]

impl AddAssign<Duration> for Instant[src]

impl SubAssign<Duration> for Duration[src]

impl SubAssign<Duration> for Instant[src]

impl MulAssign<u32> for Duration[src]

impl DivAssign<u32> for Duration[src]

Auto Trait Implementations

impl Send for Duration

impl Sync for Duration

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.