Coding in rust makes me feel so stupid :P
It seems I need to place the mutex into an arc after all?
@yosh I think my issue is that I am trying to reuse it both in a closure and later in some other code.
I think I just need to rewrite this using channels and treat the two simulated peers as fully separate peers + have them listen on incoming events generated from a third thread doing the networking.
@yosh I'm just too addicted to mutable references on the heap being trivial in JS >:P
@mauve Yeah the usual way to share data among threads is to wrap it in a `Arc<Mutex<T>>`. If you know that the access is read heavy, use an `RwLock` instead of the `Mutex`.
@mauve this is constantly how it makes me feel 😥
@dan_ballard I like the feeling tbh. It means that when I get stuff working I've learned some new skills or new ways of thinking I can apply for future problems.
I think the tool I'll use here is to structure what I want like coroutines and leverage channels for the inter-thread messaging.
@mauve mutexes do tend to need to be placed in arcs to work correctly!