> Golang supports running asynchronous code in defers, similar with Zig when it still had async.
So does Rust. You can run async code inside `drop`.
So does Rust. You can run async code inside `drop`.
And this would be basically what you have to do in Go anyways - you need to explicitly use defer if you want code to run on destruction, with the caveat that in Go nothing stops you from forgetting to call it, when in Rust I can at least have a deterministic guard that would panic if I forget to call the explicit destructor before the object getting out of scope.
BTW async drop is being worked on in Rust, so in the future this minor annoyance will be gone