-
Notifications
You must be signed in to change notification settings - Fork 613
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
Add Channel#trySend
#2768
Add Channel#trySend
#2768
Conversation
/** Provides an interface to the channel as a [[QueueSink]]. | ||
* Offering elements to a closed queue will raise a [[Channel.ClosedException]]. | ||
*/ | ||
def asQueueSink: QueueSink[F, A] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, Channel
itself could extend QueueSink
?
Some feedback from @SystemFw
I think those are fair points. WDYT about reducing the scope of this PR to just the |
Ok, I came to appreciate Fabio's point, and I changed my mind about the |
Opening to get feedback on the idea, which is to provide a "view" to a
Channel
as aQueueSink
. This allows APIs to use theQueueSink
interface and for aChannel
to be plugged in as an implementation detail.To adapt the
Channel
interface forQueueSink
I added:trySend
(analog totryOffer
), which is a non-blocking version ofsend
.Channel.ClosedException
which is thrown when encountering aChannel.Closed
.Thanks for your consideration.