pub fn send_or_cancel<T>(
sender: &Sender<T>,
value: T,
cancel: &Receiver<()>,
) -> Result<(), SendError<T>>Expand description
Selects between sending a value and receiving a cancellation message or disconnection.
Returns the unsent value when cancellation is selected or the output disconnects. Selection is unbiased: if both operations are ready, either may win, even when cancellation was already signalled. A rendezvous send completes only when consumed.