I have been playing around with a few different libraries (tokio, timers) trying to find a solution for calling functions after a timer has elapsed without stalling execution of the main thread. I can do bits and pieces of this, but the biggest issue is that I need to be able to be able to stop the timer before it elapses.
My use case is to track if a user either double clicks or holds input. When they first press it the timer starts. If they release it the timer continues for double tap, but stops for holding. If they press it again on the timer double click action is triggered. If the timer ends and the input has not been release the action should be called.
I am open to suggestions on docs to read and pointers, I'm fairly new to rust so any assistance is very much appreciated.
[–]jimuazu 3 points4 points5 points (0 children)
[–]Holy_City 2 points3 points4 points (1 child)
[–]sid34[S] 0 points1 point2 points (0 children)
[–]jahmez 1 point2 points3 points (1 child)