Re:Zero to Production in Rust
by zinclozenge on Saturday June 05, 2021 @12:38PM
(#27406488)
What's the deal with cancellations? If you're coming from Go, the context package makes it convenient to do.
Re:Zero to Production in Rust
by ibraheemdev on Saturday June 05, 2021 @01:17PM
(#27406834)
Funny you mentioned the context package, as it was pretty hacky way to work around the cancellation problem.
There are some pain points with cancellation in Rust. Dropping a future cancels it, but that requires ownership over the future, and may cause unexpected behavior due to the nature of futures state machines. This, along with many other issues, is being discussed by the async working group: https://github.com/rust-lang/wg-async-foundations/issues/65. If you have specific suggestions, or a problem that you faced, please open an issue! It is really appreciated - async rust's problems cannot be solved without community feedback and engagement.
To use? Eh - I just turn on async_std with the Tokio flag and write go-like code with async tasks. No issues thus far.