[−][src]Struct wasm_stopwatch::Stopwatch
A stopwatch which tracks time in seconds, using performance.now()
.
Methods
impl Stopwatch
[src]
pub fn new() -> Self
[src]
Creates a new stopwatch with the current time set to 0.
pub fn with_speed(speed: f64) -> Self
[src]
Creates a stopwatch which advances the given amount every second.
For instance, Stopwatch::with_speed(1.0/60.0)
creates a stopwatch which uses
minutes as the time unit instead of seconds.
pub fn paused(&self) -> bool
[src]
Returns whether the stopwatch is paused.
pub fn pause(&mut self)
[src]
Pauses the stopwatch. If the stopwatch was already paused, this does nothing.
pub fn unpause(&mut self)
[src]
Unpauses the stopwatch. If the stopwatch was already unpaused, this does nothing.
pub fn toggle_pause(&mut self)
[src]
Toggles whether the stopwatch is paused.
pub fn get_time(&self) -> f64
[src]
Gets the current time.
pub fn set_time(&mut self, cur_time: f64)
[src]
Sets the current time.
pub fn reset(&mut self)
[src]
Resets the stopwatch to zero.
pub fn add_time(&mut self, time_diff: f64)
[src]
Advances the stopwatch by time_diff
.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,