Enum amethyst_core::timing::Stopwatch [−][src]
A stopwatch which accurately measures elapsed time.
Variants
WaitingInitial state with an elapsed time value of 0 seconds.
Started(Duration, Instant)Stopwatch has started counting the elapsed time since this Instant
and accumuluated time from previous start/stop cycles Duration.
Ended(Duration)Stopwatch has been stopped and reports the elapsed time Duration.
Methods
impl Stopwatch[src]
impl Stopwatchpub fn new() -> Stopwatch[src]
pub fn new() -> StopwatchCreates a new stopwatch.
pub fn elapsed(&self) -> Duration[src]
pub fn elapsed(&self) -> DurationRetrieves the elapsed time.
pub fn restart(&mut self)[src]
pub fn restart(&mut self)Stops, resets, and starts the stopwatch again.
pub fn start(&mut self)[src]
pub fn start(&mut self)Starts, or resumes, measuring elapsed time. If the stopwatch has been started and stopped before, the new results are compounded onto the existing elapsed time value.
Note: Starting an already running stopwatch will do nothing.
pub fn stop(&mut self)[src]
pub fn stop(&mut self)Stops measuring elapsed time.
Note: Stopping a stopwatch that isn't running will do nothing.
pub fn reset(&mut self)[src]
pub fn reset(&mut self)Clears the current elapsed time value.
Trait Implementations
impl Clone for Stopwatch[src]
impl Clone for Stopwatchfn clone(&self) -> Stopwatch[src]
fn clone(&self) -> StopwatchReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for Stopwatch[src]
impl Debug for Stopwatchfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Eq for Stopwatch[src]
impl Eq for Stopwatchimpl PartialEq for Stopwatch[src]
impl PartialEq for Stopwatchfn eq(&self, other: &Stopwatch) -> bool[src]
fn eq(&self, other: &Stopwatch) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Stopwatch) -> bool[src]
fn ne(&self, other: &Stopwatch) -> boolThis method tests for !=.
impl Default for Stopwatch[src]
impl Default for Stopwatch