3 ms·
Hello, Rust – Go vs. Rust: Concurrency and Race Conditions
- omn1 8y agoOne could also write the Go version using channels [1] and the Rust version in a more functional way [2], but overall the code is quite straightforward in both languages. Only thing I don't like about the Rust version is, that the error message is still a bit cryptic: ``` Cannot borrow data mutably in a captured outer variable in an `Fn` closure. ``` But the important part is that Rust prevents a data race at compile time, which is nice. [1]: https://github.com/hello-rust/show/pull/46 https://github.com/hello-rust/show/pull/46 [2]: https://github.com/hello-rust/show/pull/45 https://github.com/hello-rust/show/pull/45