Function identity_common::cancel_or

source ·
pub async fn cancel_or<Fut, T>(cancel: &TaskGroupCancel, fut: Fut) -> Option<T>where
    Fut: Future<Output = T> + FusedFuture + Unpin,
Expand description

Returns a future which resolves either when cancel or fut is ready. If both are ready, cancel takes precedence. If the provided future wins, its output is returned. If cancel wins, None is returned.