I hotreload Rust and so can you

30 points by sp6370


aziis98

Great article! I can't wait to pick back Rust and do something with this technique. I also noticed macroquad, I'm also great a fan of that. It's really good for simple 2d drawing and rendering.

pervognsen

And since this only happens in “development mode” we don’t particularly need to worry about it. Just keep in mind that state stored in a thread local won’t be preserved.

This can definitely lead to UB (including in third-party crates where you don't know the implementation) if you're relying on an invariant that is tracked by thread-local state, e.g. call some lazy initialization function at most once per thread (and if you call it twice it leads to UB) by guarding it with a thread-local Cell<bool>/AtomicBool. Restricting this to dev builds makes the potential issues tolerable, but it's worth keeping in mind.

pervognsen
Comment removed by author
aapoalas

Oh, that's cool!