This is pretty cool, but at the same time it's unfortunate to be reading things like "one could simply write" followed by "hc: impl HealthCheck<check(): Send> + Send + 'static".
I really enjoy writing Rust but I feel like a lot of things related to async just don't map very cleanly to the rest of the language. Apart from the complicated type shenanigans in this post there are a lot of gotchas with async that result in panics at runtime instead of compilation errors. Basically, I don't feel like Rust has my back when I'm writing async code.
Disclaimer: I am not a language designer so I have no clear idea how this could be solved, and I appreciate it's a very difficult problem!
Funny, I saw that same line and thought "oh yes, that is much cleaner". Well, it is a little goofy to have what looks like a function call in the middle of a type signature, but the `Send + 'static` are simply what's needed if you want to use some sort of magical N:M thread pool in a language with TLS.
Honestly, a lot of the challenges people face with Rust async is because they're trying to use a really low-level primitive instead of just using normal threads. They come from a language like JavaScript or Python where async is the only option for concurrent I/O, and they don't realize that JS async is a completely different construct from Rust async. They'd be better off using threads.
I really enjoy writing Rust but I feel like a lot of things related to async just don't map very cleanly to the rest of the language. Apart from the complicated type shenanigans in this post there are a lot of gotchas with async that result in panics at runtime instead of compilation errors. Basically, I don't feel like Rust has my back when I'm writing async code.
Disclaimer: I am not a language designer so I have no clear idea how this could be solved, and I appreciate it's a very difficult problem!