macro_rules! try_join {
($($tokens:tt)*) => { ... };
}Expand description
Waits for multiple fallible concurrent futures, returning when all complete successfully.
This macro provides a runtime-agnostic way to execute multiple async operations that
return Result and wait for all of them to complete. If any operation fails, the error
is returned immediately. When using the Tokio runtime, this delegates to tokio::try_join!.
When using the simulator runtime, this uses the simulator’s implementation.
§Examples
let (a, b) = switchy::unsync::try_join!(
async { Ok::<_, std::io::Error>(1) },
async { Ok::<_, std::io::Error>(2) },
)?;
assert_eq!(a, 1);
assert_eq!(b, 2);