classic. this has been a problem since the language was new.
the problem is that Rust is designed to not have this as a use case, or rather has machinery to make this marginally safer (mutexes etc) or make it unstable (panic) or just as unsafe as C (unsafe). if this is a pattern you want to maintain, Rust is going to throw friction at you by design, because tbh this pattern is the source of a ton of bugs.
it’s conceptually more complicated, but game engine devs have been moving to some form of Entity Component System[1] architecture, because it gives you a way to access memory that is both cache efficient and safe.
all that said i’m not a game dev. i think Bevy[2] was the blessed solution for a while?
classic. this has been a problem since the language was new.
the problem is that Rust is designed to not have this as a use case, or rather has machinery to make this marginally safer (mutexes etc) or make it unstable (panic) or just as unsafe as C (
unsafe). if this is a pattern you want to maintain, Rust is going to throw friction at you by design, because tbh this pattern is the source of a ton of bugs.it’s conceptually more complicated, but game engine devs have been moving to some form of Entity Component System[1] architecture, because it gives you a way to access memory that is both cache efficient and safe.
all that said i’m not a game dev. i think Bevy[2] was the blessed solution for a while?
1: https://en.wikipedia.org/wiki/Entity_component_system?wprov=sfti1 2: https://bevy.org/