When WaitSet::stop was called, the WaitSet becomes unusable. The original intention was to interrupt the callback, not the WaitSet usage completely.
The user would like to interrupt the wait_and_process call after a specific event
It shall be possible to recall it again and continue
All unhandled events will be lost
Improvement Suggestion
Remove WaitSet::stop() and use the existing CallbackProgression approach for callbacks, see: WaitSet::wait_and_process<F: FnMut(WaitSetAttachmentId<Service>) /* NEW*/ -> CallbackProgression>
introduce WaitSet::blocking_wait_and_process_once() it blocking waits until 1..N events arrived, calls the callback for every event and then returns back to the user in contrast to WaitSet::wait_and_process() that keeps going.
WaitSet::try_wait_and_process() actually blocks for timers, this needs to be refactored so that it is non-blocking
rename WaitSet::wait_and_process into WaitSet::blocking_wait_and_process.
(Code) Example Of Cumbersome API
When
WaitSet::stop
was called, theWaitSet
becomes unusable. The original intention was to interrupt the callback, not theWaitSet
usage completely.wait_and_process
call after a specific eventImprovement Suggestion
WaitSet::stop()
and use the existingCallbackProgression
approach for callbacks, see:WaitSet::wait_and_process<F: FnMut(WaitSetAttachmentId<Service>) /* NEW*/ -> CallbackProgression>
WaitSet::blocking_wait_and_process_once()
it blocking waits until 1..N events arrived, calls the callback for every event and then returns back to the user in contrast toWaitSet::wait_and_process()
that keeps going.WaitSet::try_wait_and_process()
actually blocks for timers, this needs to be refactored so that it is non-blockingWaitSet::wait_and_process
intoWaitSet::blocking_wait_and_process
.