Function pending_if

Source
pub async fn pending_if<T>(condition: bool, fut: impl Future<Output = T>) -> T
Expand description

Awaits a provided future if a condition holds, otherwise yields a pending future that never resolves. This function evaluates a boolean and, when true, awaits and returns the output of the supplied future; if false, it defers execution indefinitely by awaiting a future that remains pending.