You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the channel is empty and still has senders, this method will wait until a message is sent into it. Once all senders have been dropped it will return None.
How can it return None when the type signature is pub async fn recv<'_>(&'_ self) -> Result<T, RecvError>? It appears to be throwing an error instead, and an opaque error type too which makes it impossible to respond correctly to the specific situation where the senders were dropped vs some other kind of error condition.
This code triggers a panic on the last line panicked at 'The channel is empty.':
The text was updated successfully, but these errors were encountered:
kellpossible
changed the title
Receiver docs say it returns None when all senders have been dropped, but this is impossible
channel Receiver docs say it returns None when all senders have been dropped, but this is impossible
Aug 12, 2020
https://docs.rs/async-std/1.6.2/async_std/sync/struct.Receiver.html#impl
Docs for
recv()
:How can it return
None
when the type signature ispub async fn recv<'_>(&'_ self) -> Result<T, RecvError>
? It appears to be throwing an error instead, and an opaque error type too which makes it impossible to respond correctly to the specific situation where the senders were dropped vs some other kind of error condition.This code triggers a panic on the last line
panicked at 'The channel is empty.'
:The text was updated successfully, but these errors were encountered: