I need to save a ready or pending future in a variable depending on a condition.
Would be nice if I could do this:
let f = futures::future::ready(true);
But the API provides two different functions, which have different return types, so, this does not work either:
let f = if true { futures::future::ready(()) } else { futures::future::pending::<()>() }
I understand that I can implement my own future for this, but I wonder if there is a way to make the if
expression work?