spin_sleep_util

Crates.iospin_sleep_util
lib.rsspin_sleep_util
version0.1.1
sourcesrc
created_at2024-01-04 15:26:58.713011
updated_at2024-01-05 22:33:12.331954
descriptionUtils using spin_sleep
homepage
repositoryhttps://github.com/alexheretic/spin-sleep
max_upload_size
id1088737
size30,801
Alex Butler (alexheretic)

documentation

README

spin_sleep_util crates.io Documentation

Utils using spin_sleep.

Example: Frame limiter

Interval may be used to limit a loop to a max fps by calling Interval::tick at the start or end of each loop.

// Create an interval to tick 144 times each second
let mut interval = spin_sleep_util::interval(Duration::from_secs(1) / 144);
loop {
    compute_something(); // do loop work

    // tick: sleep using a SpinSleeper until next tick.
    // The default `Skip` missed ticke behaviour is appropriate for a frame limiter
    interval.tick();
}
Commit count: 60

cargo fmt