pub struct Stopwatch {
pub lap_elapsed: Duration,
pub paused: bool,
pub data: StopwatchData,
}Fields§
§lap_elapsed: Duration§paused: bool§data: StopwatchDataImplementations§
Source§impl Stopwatch
impl Stopwatch
Sourcepub fn new() -> Self
pub fn new() -> Self
initialise a new stopwatch instance.
The stopwatch is paused at zero and will not run until you call .resume()
or .pause_or_resume().
Sourcepub fn pause_or_resume(&mut self)
pub fn pause_or_resume(&mut self)
Pause or resume the timer.
pub fn pause_or_resume_at(&mut self, moment: DateTime<Local>)
Sourcepub fn lap(&mut self) -> Option<Duration>
pub fn lap(&mut self) -> Option<Duration>
Lap the stopwatch. If the stopwatch is running, return Some(<laptime>).
If the stopwatch is paused, return None.
pub fn lap_at(&mut self, moment: DateTime<Local>) -> Option<Duration>
Sourcepub fn stop(&mut self) -> StopwatchData
pub fn stop(&mut self) -> StopwatchData
resets the stopwatch and returns StopwatchData
pub fn stop_at(&mut self, moment: DateTime<Local>) -> StopwatchData
pub fn pause_at(&mut self, moment: DateTime<Local>)
pub fn resume_at(&mut self, moment: DateTime<Local>)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stopwatch
impl RefUnwindSafe for Stopwatch
impl Send for Stopwatch
impl Sync for Stopwatch
impl Unpin for Stopwatch
impl UnwindSafe for Stopwatch
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