Provide async iterator for event loop
j-hui opened this issue · comments
I'm hoping to integrate the piston event loop with some other async code. Is this a feature you would consider supporting?
As a proof-of-concept, I implemented this, with only two lines of change to the next()
function; one to replace the use of spin_sleep
with tokio::time::sleep
, and one to declare the next()
function async
.
I have two questions about this:
- Are there any pitfalls I'm missing here?
- Considering the changes needed are so small, would you consider adding async support to your event_loop, to avoid my duplicating that code?
Can you elaborate on the motivation for using an async event loop? Are there any tradeoffs?