Closed vedantroy closed 3 years ago
@vedantroy nope, but I was waiting for somebody to ask for that. As I said, I have been having some spare time today to implement stuff in yaque. I will create a pull request for that.
We are in luck! We can use the futures::FutureExt::now_or_never
utility to achieve this behavior, without the need to refactor all the code.
PR #10 . Some considerations:
I think this is not the most efficient way of implementing try_recv
, since it uses the async functions under the hood and thus does some stuff which is not useful for only one poll. However, it is not a horrible idea and it is Easy to Explain©. Let's worry about benchmarks in a future version.
Try recv implemented and available in version v0.6.0
Is there a function that will try receiving, and if the queue has no data, will return None?
It seems like I can manually replicate this now by using
recv_timeout
with a very small timeout, but wondering if there was a more idiomatic way?