spin_sleep_util 0.1.1

Utils using spin_sleep
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented5 out of 5 items with examples
  • Size
  • Source code size: 33.02 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 999.57 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • alexheretic/spin-sleep
    163 13 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • alexheretic

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();
}