I need to run 4 functions concurrently but one of them is different based on user input.
If I use "if-else" I get "if and else have incompatible types" due to Future.
The only way I see is to make a third function that selects from the other two, but it doesn't allow (to my knowledge) to run concurrently due to awaiting.
Another way is to make two different join! but that seems "code expensive".
What should I do in this situation?
tokio::join!(
self.func1(),
if self.flag() {
self.func2()
} else {
self.func3()
},
self.func4(),
self.func5()
);
The function signature is as follows:
pub async fn funcN(&self) -> Result<Vec<String>> {