[][src]Struct ephemeris::Duration

pub struct Duration { /* fields omitted */ }

A time-based amount of time, such as '34.5 seconds'.

Methods

impl Duration[src]

pub const MIN: Duration[src]

Constant for a duration with the greatest negative length.

pub const ZERO: Duration[src]

Constant for a duration of zero length.

pub const MAX: Duration[src]

Constant for a duration with the greatest positive length.

pub fn of_days(days: i64) -> Duration[src]

Obtains a Duration representing a number of standard days.

The seconds are calculated based on the standard definition of a day, where each day is 86,400 seconds. The nanosecond in second field is set to zero.

Parameters

  • days: the days in the duration.

Panics

  • if the amount of days would overflow the duration.

pub fn of_hours(hours: i64) -> Duration[src]

Obtains a Duration representing a number of standard hours.

The seconds are calculated based on the standard definition of an hour, where each hour is 3600 seconds. The nanosecond in second field is set to zero.

Parameters

  • hours: the hours in the duration.

Panics

  • if the amount of hours would overflow the duration.

pub fn of_minutes(minutes: i64) -> Duration[src]

Obtains a Duration representing a number of standard minutes.

The seconds are calculated based on the standard definition of a minute, where each minute is 60 seconds. The nanosecond in second field is set to zero.

Parameters

  • minutes: the minutes in the duration.

Panics

  • if the amount of minutes would overflow the duration.

pub fn of_seconds_and_adjustment(seconds: i64, nano_adjustment: i64) -> Duration[src]

Obtains a Duration representing a number of seconds and an adjustment in nanoseconds.

Parameters

  • seconds: the seconds in the duration.
  • nano_adjustment: the adjustment amount from the given second.

Panics

  • if the adjusted amount of seconds would overflow the duration.

pub fn of_seconds(seconds: i64) -> Duration[src]

Obtains a Duration representing a number of seconds.

The nanosecond field will be set to 0.

Parameters

  • seconds: the seconds in the duration.

pub fn of_millis(millis: i64) -> Duration[src]

Obtains a Duration representing a number of milliseconds.

The seconds and nanoseconds are extracted from the specified milliseconds.

Parameters

  • millis: the milliseconds in the duration.

pub fn of_nanos(nanoseconds: i64) -> Duration[src]

Obtains a Duration representing a number of nanoseconds.

The seconds and nanoseconds are extracted from the specified nanoseconds.

Parameters

  • nanos: the nanos in the duration.

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

Gets the number of nanoseconds within the second in this duration.

pub const fn seconds(&self) -> i64[src]

Gets the number of seconds in this duration.

Trait Implementations

impl Clone for Duration[src]

impl Copy for Duration[src]

impl Debug for Duration[src]

impl Default for Duration[src]

impl Eq for Duration[src]

impl Hash for Duration[src]

impl Ord for Duration[src]

impl PartialEq<Duration> for Duration[src]

impl PartialOrd<Duration> for Duration[src]

impl StructuralEq for Duration[src]

impl StructuralPartialEq for Duration[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.