4 ms·
Having used Rust for several months, I'd say that multithreading is still one of the biggest pain points (strangely, as it's also one of their headline features
by _bxg1 7y ago
Having used Rust for several months, I'd say that multithreading is still one of the biggest pain points (strangely, as it's also one of their headline features). The only thing I've encountered so far that's harder is pointer-juggling data structures, but at least in that case you can mostly just use the (excellent) ones in the standard library.
The "crossbeam" library helps a lot: https://docs.rs/crossbeam/0.7.2/crossbeam/ https://docs.rs/crossbeam/0.7.2/crossbeam/ It's the only way I know of to have thread closures with a less-than-static lifetime, which helps a ton with borrowing/moving and also general encapsulation: https://docs.rs/crossbeam/0.7.2/crossbeam/fn.scope.html https://docs.rs/crossbeam/0.7.2/crossbeam/fn.scope.html.
Once you get the hang of it you can move forward pretty well, but the ergonomics around Rust concurrency, especially in the standard library, really need some work if they're going to continue focusing on it in their marketing materials.