You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
start_new() is presumably a convenience method for doing new() + start() in one call?
Difference between reset() and restart()?
Just from a glance of the the minimal info presented to a user, those were two things that stood out. Compared to using the standard Instant from Rust, I was interested in time taken between calls, turned out that was added as a feature that never arrived to crates.io.
As a user, I can try the methods out individually, but knowing in advance would have been nicer. Below is for any other user not wanting to try the API out or look over source:
restart(): Continues running the timer but restarting from 0.
reset(): Stops the timer and resets the value to 0.
stop(): Stops the timer but doesn't reset the value.
new(): Creates a timer but does not start it. restart() will also initiate the timer like start(). Must be mutable to track time.
start_new(): Creates the timer and starts it. Does not need to be mutable for elapsed time tracking.
For lap functionality where you want to get the elapsed time since your previous measurement, you need a mutable stopwatch and to call sw.restart() between your two sw.elapsed_ms() calls. Alternatively if you source the crate from github instead of crates.io, you can use sw.elapsed_split_ms()
The text was updated successfully, but these errors were encountered:
start_new()
is presumably a convenience method for doingnew()
+start()
in one call?reset()
andrestart()
?Just from a glance of the the minimal info presented to a user, those were two things that stood out. Compared to using the standard
Instant
from Rust, I was interested in time taken between calls, turned out that was added as a feature that never arrived to crates.io.As a user, I can try the methods out individually, but knowing in advance would have been nicer. Below is for any other user not wanting to try the API out or look over source:
restart()
: Continues running the timer but restarting from 0.reset()
: Stops the timer and resets the value to 0.stop()
: Stops the timer but doesn't reset the value.new()
: Creates a timer but does not start it.restart()
will also initiate the timer likestart()
. Must be mutable to track time.start_new()
: Creates the timer and starts it. Does not need to be mutable for elapsed time tracking.For lap functionality where you want to get the elapsed time since your previous measurement, you need a mutable stopwatch and to call
sw.restart()
between your twosw.elapsed_ms()
calls. Alternatively if you source the crate from github instead of crates.io, you can usesw.elapsed_split_ms()
The text was updated successfully, but these errors were encountered: