pub struct Timer { /* private fields */ }Expand description
A fixed-rate real-time loop timer.
Sleeps until the next scheduled tick, then records the measured delta and
accumulated elapsed time. Timing state is advanced only by Self::wait.
Implementations§
Source§impl Timer
impl Timer
Sourcepub fn dt(&self) -> Duration
pub fn dt(&self) -> Duration
Returns the measured delta from the last completed Self::wait.
Before the first wait, this is zero.
Sourcepub fn elapsed(&self) -> Duration
pub fn elapsed(&self) -> Duration
Returns the accumulated elapsed time.
This value is advanced only by Self::wait.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Timer
impl RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl UnsafeUnpin for Timer
impl UnwindSafe for Timer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more