-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support dynamic select #7
Conversation
I found a mistake, so I am moving it back to draft. |
I fixed the mistake. |
Hey! Thanks for the contribution. This is a super interesting change and seems like a good addition to the library. I have a couple of suggestions:
ex: await select {
any([a, b]) {
receive($0) { await result <- $0! }
}
}
public func any<T>(_ elements: T..., @SelectCollector cases: (T) -> ([SelectHandler])) -> [SelectHandler] {
return elements.flatMap { cases($0) }
} would allow us to also perform an operation like this await select {
any(a, b) {
receive($0) { await result <- $0! }
}
} let me know your thoughts. |
Looks great. I'm going to merge this, do some additional testing, and publish this in the next release. Thanks again! |
This PR allows
select
to accept an array of channels. Previously, there was no way toselect
an array of channels. This PR only modifies functions related toresultBuilders
, so the behavior of the channels will remain unchanged.