[−][src]Struct sixtyfps_corelib::timers::Timer
Timer is a handle to the timer system that allows triggering a callback to be called after a specified period of time.
Implementations
impl Timer
[src]
pub fn start(
&self,
mode: TimerMode,
duration: Duration,
callback: impl Fn() + 'static
)
[src]
&self,
mode: TimerMode,
duration: Duration,
callback: impl Fn() + 'static
)
Starts the timer with the given mode and duration, in order for the callback to called when the timer fires. If the timer has been started previously and not fired yet, then it will be restarted.
Arguments:
mode
: The timer mode to apply, i.e. whether to repeatedly fire the timer or just once.duration
: The duration from now until when the timer should fire.callback
: The function to call when the time has been reached or exceeded.
pub fn single_shot(duration: Duration, callback: impl FnOnce() + 'static)
[src]
Starts the timer with the duration, in order for the callback to called when the timer fires. It is fired only once and then deleted.
Arguments:
duration
: The duration from now until when the timer should fire.callback
: The function to call when the time has been reached or exceeded.
pub fn stop(&self)
[src]
Stops the previously started timer. Does nothing if the timer has never been started. A stopped timer cannot be restarted with restart() -- instead you need to call start().
pub fn restart(&self)
[src]
Restarts the timer, if it was previously started.
pub fn running(&self) -> bool
[src]
Returns true if the timer is running; false otherwise.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Timer
impl Send for Timer
impl !Sync for Timer
impl Unpin for Timer
impl UnwindSafe for Timer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,