in an application I’m currently working on, I’d like to test a channel receiver if it has any messages that could be received.
try_recv() method sort-of-kind-of does that, but in case the receiver indeed has messages, it will extract the message, which forces me to propagate the result through many levels of code in order to not lose the message.
I tried using
.iter().peekable() on the receiver, but it’s no use, it always blocks.
Why is there no method on the receiver that would indicate whether the receiver has messages? It seems the logic is alredy there somewhere in the
try_recv() method, it just seems not exposed in the API. Or is there a technical reason this is not exposed?