4 ms·
> What do closures have to do with async-await in Rust? Well, space _blocking runs blocking code in an async context. It takes a closure as it's argument and i
by fnord123 5y ago
> What do closures have to do with async-await in Rust?
Well, space _blocking runs blocking code in an async context. It takes a closure as it's argument and if you're in a mixed async/sync platform you will his this function a lot. To deal with it you end up needing to use move. And to use move you need to clone your pointers to the data and manage all that guff.
The alternatives are Arc, deep copies, or use C++ where you will invariably get it wrong and end up with corrupted data and a very bad week (or you don't notice and reply to this comment saying that you do this in C++ and never had a problem)