Struct sdl2::TimerSubsystem
source · [−]pub struct TimerSubsystem { /* private fields */ }
Implementations
sourceimpl TimerSubsystem
impl TimerSubsystem
sourceimpl 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(&self) -> u32
pub fn ticks(&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
sourceimpl Clone for TimerSubsystem
impl Clone for TimerSubsystem
sourcefn clone(&self) -> TimerSubsystem
fn clone(&self) -> TimerSubsystem
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Sync for TimerSubsystem
Auto Trait Implementations
impl RefUnwindSafe for TimerSubsystem
impl !Send for TimerSubsystem
impl Unpin for TimerSubsystem
impl UnwindSafe for TimerSubsystem
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more