One 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 comment
[ 2.8 ms ] story [ 13.8 ms ] threadOnly 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 [2]: https://github.com/hello-rust/show/pull/45