Uh oh!
There was an error while loading. Please reload this page.
Allow more "error" values in try_recv() - #11112
Conversation
bill-myers
commented
Dec 24, 2013
Renaming it to a try_recv_opt that returns Option<Option> seems a better approach, as it doesn't introduce an extra enum type, and follows the simple logic that a nonblocking version of a function (try_recv_opt vs recv_opt in this case) wraps the result of the blocking function in an Option, which allows to convert code between the blocking and non-blocking versions in a straightforward fashion. Also, Result is supposed to be used for things were it is reasonable to fail! on any error, and it is of course usually not appropriate to fail! on a non-blocking function not returning input yet (that leads to random timing/scheduler dependent failures unless there's some extra serialization to prevent it). BTW, maybe changing recv_opt to return Result<T, ()> instead of Option might make sense, but that's orthogonal. |
brson
commented
Jan 13, 2014
I think I agree that this should not return a |
brson
commented
Jan 13, 2014
|
brson
commented
Jan 13, 2014
I'm having a hard time even imagining what |
alexcrichton
commented
Jan 14, 2014
Changed to |
This should allow callers to know whether the channel was empty or disconnected without having to block. Closesrust-lang#11087
This should allow callers to know whether the channel was empty or disconnected without having to block. Closes#11087
11112: Evaluate constants in array repeat expression r=HKalbasi a=HKalbasi cc rust-lang#8655 Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
This should allow callers to know whether the channel was empty or disconnected
without having to block.
Closes#11087