Struct sdl2::TimerSubsystem
source · pub struct TimerSubsystem { /* private fields */ }
Implementations§
source§impl TimerSubsystem
impl TimerSubsystem
sourcepub fn add_timer<'b, 'c>(
&'b self,
delay: u32,
callback: TimerCallback<'c>,
) -> Timer<'b, 'c>
pub fn add_timer<'b, 'c>( &'b self, delay: u32, callback: TimerCallback<'c>, ) -> Timer<'b, 'c>
Constructs a new timer using the boxed closure callback
.
The timer is started immediately, it will be cancelled either:
- when the timer is dropped
- or when the callback returns a non-positive continuation interval
sourcepub fn ticks(&mut self) -> u32
pub fn ticks(&mut self) -> u32
Gets the number of milliseconds elapsed since the timer subsystem was initialized.
It’s recommended that you use another library for timekeeping, such as time
.
sourcepub fn delay(&mut self, ms: u32)
pub fn delay(&mut self, ms: u32)
Sleeps the current thread for the specified amount of milliseconds.
It’s recommended that you use std::thread::sleep()
instead.
pub fn performance_counter(&self) -> u64
pub fn performance_frequency(&self) -> u64
Trait Implementations§
impl Sync for TimerSubsystem
Auto Trait Implementations§
impl Freeze for TimerSubsystem
impl RefUnwindSafe for TimerSubsystem
impl !Send for TimerSubsystem
impl Unpin for TimerSubsystem
impl UnwindSafe for TimerSubsystem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more