home ~ projects ~ socials

Set A Debounce Value For watchexec Projects

This one took me a while to figure out because I was doing the math wrong. Debouncing changes is done in the watchexec RuntimeConfig with:

runtime.action_throttle(Duration::new(0, 100000000));

That value of 100000000 is in nano seconds whichs translates to 0.1 second.

Notes

  • That line probably isn't super useful by itself. I've got a more fleshed out example on this page that should help
  • The 0 in the first part of `Duration::new()`rust` is for seconds if you're looking for longer time frames without so many zeros
-- end of line --

References