The closure in the poll() function cannot be propagated out of the stack. Sometimes, it's desireable to have a result move from the internal closure to external context to handle control flow.
Difficulties:
The poll() closure may execute multiple times, so if some Ok(x) were returned, only the last value could be provided
Perhaps we could allow an Error to exit the poll() loop early to allow Error codes to propagate outwards, but this wouldn't allow external Ok(result) data to be propagated.
The closure in the
poll()
function cannot be propagated out of the stack. Sometimes, it's desireable to have a result move from the internal closure to external context to handle control flow.Difficulties:
poll()
closure may execute multiple times, so if someOk(x)
were returned, only the last value could be providedPerhaps we could allow an
Error
to exit thepoll()
loop early to allowError
codes to propagate outwards, but this wouldn't allow externalOk(result)
data to be propagated.