Expand description
§Stopwatch
A stopwatch that mimics iOS’s stopwatch.
§Usage
- Use
Stopwatch::new()to initialise a new stopwatch instance. The stopwatch is paused at00:00and will not run until you call.resume()or.pause_or_resume(). - While running:
- Call
.lap()to record lap times. - Call
.pause_or_resume(),.pause()or.resume()to pause or resume.
- Call
- When you want to stop (reset), call
.stop(), which resets the stopwatch and returnsStopwatchData
§Examples
§Schematic
ⓘ
lap lap lap
start start | | start |
o--------x o-----------x o-----------x
pause pause pause(end)Structs§
- Stopwatch
- Stopwatch
Data - The data returned by
Stopwatchupon.stopping (i.e. resetting)