The current channels are not analogous to the libstd ones. A notable missing feature is Receiver::try_recv for taking an item from the channel in a non blocking fashion.
I have a service where background workers conjure fairly expensive resources (start virtual machines, all of which are identical) and they then pass handles to these via a channel. On the other end is a user facing API where access to one such resource can be requested. I want to use try_recv to get an available resource from the channel. Because if there are no resources available I want the request to fail immediately. The API should yield immediate results, and no long queues should be built up.
The current channels are not analogous to the libstd ones. A notable missing feature is
Receiver::try_recvfor taking an item from the channel in a non blocking fashion.I have a service where background workers conjure fairly expensive resources (start virtual machines, all of which are identical) and they then pass handles to these via a channel. On the other end is a user facing API where access to one such resource can be requested. I want to use
try_recvto get an available resource from the channel. Because if there are no resources available I want the request to fail immediately. The API should yield immediate results, and no long queues should be built up.