[][src]Struct rusty_timer::Timer

pub struct Timer { /* fields omitted */ }

The Timer struct calculates delta time and if fixed updates should be done to calculate the times, the crate's stopwatch is used

Implementations

impl Timer[src]

pub fn new() -> Self[src]

Create a new timer object time since last fixed update is set to a high number on creation to get a fixed update on start

pub fn time_since_start(&self) -> Duration[src]

Get the time since start of the timer

pub fn update_delta_time(&mut self)[src]

update the delta time and time since start place this on the beginning of the loop

pub fn update_fixed_time(&mut self)[src]

update the time since last fixed update place this after update delta time this function is not required if no fixed update is used

pub fn should_fixed_update(&self) -> bool[src]

returns a bool if a fixed update should be done this function is not required if no fixed update is used

pub fn set_fixed_interval(&mut self, fixed_interval: Duration)[src]

set the interval of a fixed update in seconds this function is not required if no fixed update is used

pub fn delta_time(&self) -> Duration[src]

public getter for the delta time

pub fn fixed_interval(&self) -> Duration[src]

public getter for the delta fixed interval

pub fn time_since_last_fixed(&self) -> Duration[src]

public getter for the time since the last fixed update

Trait Implementations

impl Default for Timer[src]

impl Send for Timer[src]

impl Sync for Timer[src]

Auto Trait Implementations

impl RefUnwindSafe for Timer

impl Unpin for Timer

impl UnwindSafe for Timer

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, 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.