pub struct Timer { /* private fields */ }
Expand description
Timer provides extremely basic timing abilities
Implementations§
Source§impl Timer
impl Timer
Sourcepub fn new() -> Timer
pub fn new() -> Timer
Creates a new timer of zero Duration
.
Similar to std::time::Instant
as this is really only useful
for getting elapsed
time since reset
Sourcepub fn with_duration(duration: Duration) -> Timer
pub fn with_duration(duration: Duration) -> Timer
Creates a new timer with duration
length
Sourcepub fn reset(&self)
pub fn reset(&self)
Resets the timer.
§Note
The decision was made intentionally to only require a &self
for
resetting a timer so that another object can own a Timer
and not require
&mut self
of the object owning the timer.
elapsed()
will start over at 0 after a reset()
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 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