Skip to content

Conversation

@faern
Copy link
Owner

@faern faern commented Feb 21, 2025

This PR adds a separate type, AsyncReceiver, that implements Future, instead of implementing it directly on the Receiver type. Now the Receiver implements IntoFuture instead.

This change removes the possible panics in many recv* methods, and it simplifies some code a bit.

This is a breaking change. So it is scheduled for the 0.2 release.

Allows removing many special cases where the receiver could previously
be received on with non-async methods after it had been polled.

I do not see any valid use case for polling a receiver, not getting a
message, and then receive in some other way.
@faern faern added this to the Release 1.0 milestone Feb 22, 2025
let channel = unsafe { self.channel_ptr.as_ref() };

// Set the channel state to disconnected and read what state the receiver was in
match channel.state.swap(DISCONNECTED, Acquire) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AsyncReceiver can observe UNPARKING state here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants