Skip to content
Discussion options

You must be logged in to vote

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 with allOf() or similar.

What is the recommended pattern when multiple tasks are interested in the events produced by that event source?

If you want a…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@abdes
Comment options

@oremanj
Comment options

oremanj Feb 12, 2025
Collaborator

@abdes
Comment options

Answer selected by abdes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants