https://play.rust-lang.org/?version=stable&mode=debug&editio...
I'm a beginner at rust, but this is the version I came up with that compiles and works:
https://play.rust-lang.org/?version=stable&mode=debug&editio...
I found this helpful: https://youtu.be/29LLRKIL_TI?t=1340
> Map is like a Go map[interface{}]interface{} but is safe for concurrent use by multiple goroutines without additional locking or coordination. Loads, stores, and deletes run in amortized constant time.
Also that for most uses a concurrent map is way overkill, and a thread-safe one is both costly and basically useless (hence the Java folks not keeping the thread-safety when migrating from Hashtable to HashMap).
On the other hand they're kinda shit given how awful non-builtin data structures are in Go, and how easy it is to "leak" maps between goroutines.
If I run it locally it's not consistent:
Here's a version that does work for me: https://play.golang.org/p/b6bRb9pgIGZThe issue is that appending to slices concurrently is not safe, so you have to use a lock around the append or similar.