Does await
ing a future inside a conditional expression always resolves the future even if it would not be required to compute the logical expression?
For example:
async fn get_bool() -> bool {
todo!("the implementation is not relevant")
}
async fn do_the_thing(allowed: bool) {
if allowed && get_bool().await {
todo!("do the thing")
}
}
So if allowed
is false
, the value of get_bool
is not relevant to the if expression.
Does the future generated by get_bool
is resolved in this case?