pub struct LoopTimer {
pub start: Instant,
pub end: Instant,
pub time: Duration,
pub target: Duration,
pub count: u32,
}Expand description
Wraps the variables necessary to keep track of loop timings.
Fields§
§start: InstantThe last start of the loop.
end: InstantThe last end of the loop.
time: DurationThe last time/duration of the loop.
target: DurationThe intended time/duration of the loop.
count: u32How many iterations have been done.
Implementations§
Source§impl LoopTimer
impl LoopTimer
Sourcepub fn new(target: Duration) -> Self
pub fn new(target: Duration) -> Self
Creates a new looptimer with the given target loop duration.
Sourcepub fn new_from(now: Instant, target: Duration) -> Self
pub fn new_from(now: Instant, target: Duration) -> Self
Creates a new looptimer with the given target loop duration and a starting instant.
Sourcepub fn reset_count(&mut self)
pub fn reset_count(&mut self)
Resets the loop-counter.
Auto Trait Implementations§
impl Freeze for LoopTimer
impl RefUnwindSafe for LoopTimer
impl Send for LoopTimer
impl Sync for LoopTimer
impl Unpin for LoopTimer
impl UnsafeUnpin for LoopTimer
impl UnwindSafe for LoopTimer
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