Trait dcs2::coordination::Stopwatch
source · pub trait Stopwatch {
// Required methods
fn from_millis(millis: u64) -> Self;
fn as_secs(&self) -> u64;
fn restart(&mut self);
fn is_timeout(&self) -> bool;
fn current_time_as_secs(&mut self) -> u64;
// Provided method
fn update(&mut self) { ... }
}
Expand description
Stopwatches are used when you need to know when time is up. This is when you need to assert a certain ammount of time has passed
Required Methods§
sourcefn from_millis(millis: u64) -> Self
fn from_millis(millis: u64) -> Self
Creates a new instance with the target time as now + millis
sourcefn is_timeout(&self) -> bool
fn is_timeout(&self) -> bool
Returns true if the time set in Stopwatch::from_millis
has passed
sourcefn current_time_as_secs(&mut self) -> u64
fn current_time_as_secs(&mut self) -> u64
Returns the current stopwatch time expressed as seconds.
Provided Methods§
Object Safety§
This trait is not object safe.