Trait glissade::Time

source ·
pub trait Time:
    PartialEq
    + PartialOrd
    + Clone
    + Copy {
    type Duration: TimeDiff;

    // Required methods
    fn since(self, earlier: Self) -> Self::Duration;
    fn advance(self, duration: Self::Duration) -> Self;
}
Expand description

Time trait should be implemented for types that represent animation time. It’s implemented for f32, f64, std::time::Instant, and std::time::SystemTime by default. You can implement it for your own types.

Required Associated Types§

Required Methods§

source

fn since(self, earlier: Self) -> Self::Duration

Panics if self < earlier

source

fn advance(self, duration: Self::Duration) -> Self

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Time for f32

§

type Duration = f32

source§

fn since(self, earlier: f32) -> f32

source§

fn advance(self, duration: f32) -> f32

source§

impl Time for f64

§

type Duration = f64

source§

fn since(self, earlier: f64) -> f64

source§

fn advance(self, duration: f64) -> f64

source§

impl Time for Instant

§

type Duration = Duration

source§

fn since(self, earlier: Self) -> Self::Duration

source§

fn advance(self, duration: Self::Duration) -> Self

source§

impl Time for SystemTime

§

type Duration = Duration

source§

fn since(self, earlier: Self) -> Self::Duration

source§

fn advance(self, duration: Self::Duration) -> Self

Implementors§