@tguichaoua
i can't reply to Is tokio's `select!` cancel safe? anymore as its closed, but i just released a crate (floop), which doesn't entirely solve your issue, but could help, but it would require the functions to be combined (floop always loops, so it couldn't be used in foo)
// floop doesn't require cancel-safety, so `hoo` and `goo` are also allowed to be none-cancel-safe.
floop! {
_ = sleep(Duration::from_secs(1)) => { /* ... */ }
_ = goo() => { /* ... */ }
_ = hoo() => { /* ... */ }
}
you can also have
floop! {
_ = sleep(Duration::from_secs(1)) => { /* ... */ }
// note that while floop doesn't cancel futures it doesn't prevent other futures from
// cancelling futures.
_ = any_future_you_want_eg_foo() => { /* ... *}
}
allowing parts of a floop invocation to be split into individual functions that can be reused by multiple different floops (which would allow a 1-to-1 translation of your example without the requirement for any future to be cancel-safe) sounds like a amazing feature idea in general, thanks for the inspiration, i hope i'll manage to implement it.
should i ping you again if/when i implement floop splitting?