-
|
I may be missing something obvious, so I apologize in advance if that's the case. I failed to see any of the existing examples or test cases that models an async generator that The scenario is an event source running in a loop. It is different from the corral
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
corral doesn't currently ship with syntactic support for async generators, but async generators are logically just tasks with an ambient output stream for values. You can make an explicit stream for values using
If you want any single task to get each object sent through the channel, you can just have all the tasks simultaneously await |
Beta Was this translation helpful? Give feedback.
corral doesn't currently ship with syntactic support for async generators, but async generators are logically just tasks with an ambient output stream for values. You can make an explicit stream for values using
corral::Channel. This isn't quite the same as an async generator because there is a buffer - the sender and receiver can be operating at the same time. But it should work fine for an event stream. Instead of writing a loop for the sender to iterate over the receiver, you would start the sender and receiver as separate tasks joined withallOf()or similar.If you want a…