Struct geom::duration::Duration[][src]

pub struct Duration(f64);

A duration, in seconds. Can be negative.

Implementations

impl Duration[src]

pub const ZERO: Duration[src]

pub const EPSILON: Duration[src]

pub fn seconds(value: f64) -> Duration[src]

Creates a duration in seconds.

pub fn minutes(mins: usize) -> Duration[src]

Creates a duration in minutes.

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

Creates a duration in hours.

pub fn f64_minutes(mins: f64) -> Duration[src]

Creates a duration in minutes.

pub const fn const_seconds(value: f64) -> Duration[src]

pub(crate) fn to_u64(self) -> u64[src]

pub(crate) fn from_u64(x: u64) -> Duration[src]

pub fn inner_seconds(self) -> f64[src]

Returns the duration in seconds. Prefer working in typesafe Durations.

fn get_parts(self) -> (usize, usize, usize, usize)[src]

Splits the duration into (hours, minutes, seconds, centiseconds).

pub fn parse(string: &str) -> Result<Duration>[src]

Parses a duration such as “3:00” to Duration::minutes(3).

pub fn epsilon_eq(self, other: Duration) -> bool[src]

If two durations are within this amount, they’ll print as if they’re the same.

pub fn realtime_elapsed(since: Instant) -> Duration[src]

Returns the duration elapsed from this moment in real time.

pub fn round_up(self, multiple: Duration) -> Duration[src]

Rounds a duration up to the nearest whole number multiple.

pub fn num_minutes_rounded_up(self) -> usize[src]

Returns the duration as a number of minutes, rounded up.

pub fn make_intervals_for_max(self, num_labels: usize) -> (Duration, Vec<usize>)[src]

Returns (rounded max, the boundaries in number of minutes)

pub fn to_string(self, fmt: &UnitFmt) -> String[src]

Describes the duration according to formatting rules.

Trait Implementations

impl Add<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the + operator.

impl Add<Duration> for Time[src]

type Output = Time

The resulting type after applying the + operator.

impl AddAssign<Duration> for Duration[src]

impl AddAssign<Duration> for Time[src]

impl Clone for Duration[src]

impl Copy for Duration[src]

impl Debug for Duration[src]

impl Default for Duration[src]

impl<'de> Deserialize<'de> for Duration[src]

impl Display for Duration[src]

impl Div<Duration> for Duration[src]

type Output = f64

The resulting type after applying the / operator.

impl Div<f64> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Eq for Duration[src]

impl HgramValue<Duration> for Duration[src]

impl Mul<Duration> for f64[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<Duration> for Speed[src]

type Output = Distance

The resulting type after applying the * operator.

impl Mul<Speed> for Duration[src]

type Output = Distance

The resulting type after applying the * operator.

impl Mul<f64> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Ord for Duration[src]

impl PartialEq<Duration> for Duration[src]

impl PartialOrd<Duration> for Duration[src]

impl Rem<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the % operator.

impl Serialize for Duration[src]

impl StructuralPartialEq for Duration[src]

impl Sub<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the - operator.

impl Sub<Duration> for Time[src]

type Output = Time

The resulting type after applying the - operator.

impl SubAssign<Duration> for Duration[src]

impl Sum<Duration> for Duration[src]

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

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.