pub struct RandomAccessScheduler<'a, G>where
G: TimeGenerator,{ /* private fields */ }Expand description
A random-access scheduler.
A random-access scheduler gives you an interesting property: given any time, it will perform resolution of the action to use based on the logarithm of the number of windows being scheduled. That gives good performance for someone who is constantly changing time without ticking or unticking with a small delta.
On the opposite hand, if you don’t need that random-access property, then a sequential scheduler will make a way better job for you (it will give you a O(1) runtime performance instead of O(log N)).
Note: if you use a sequential scheduler by doing random-accesses, you are basically ruining the initial concept of a sequential scheduler (it will run in O(N) at worst).
Implementations§
Source§impl<'a, G> RandomAccessScheduler<'a, G>where
G: TimeGenerator,
impl<'a, G> RandomAccessScheduler<'a, G>where
G: TimeGenerator,
Sourcepub fn new<W>(time_gen: G, windows: W) -> Option<Self>
pub fn new<W>(time_gen: G, windows: W) -> Option<Self>
Create a new random-access scheduler.
This function might fail if the time windows are overlapping.
Sourcepub fn interruptible_with<F>(&mut self, interrupt: F)
pub fn interruptible_with<F>(&mut self, interrupt: F)
Make the scheduler interruptible with the given function
Note: the function must not block and return as soon as possible.