In rust, is there any guarantee that, with a channel created via
let (tx_net, rx_net) = mpsc::sync_channel::<Something>(1024);
that a message sent on the otherwise-empty channel shall be immediately available to [at least one] recv()?
The scenario in question is a test where a [single-threaded] routine calls send() (in the context of some crate) and then [nearly immediately] calls try_recv() where an empty return would indicate a failure. The question came up as to whether this represented a race condition. In looking at the current channel implementation, the answer is "no". But I couldn't find anything in the crate documentation that makes this promise.
N.B.: non-zero capacity channel with single-consumer
recv, which blocks until data is available or returnsErrif there will never be more data (all senders disconnected and channel is empty).