Some difficulties with porting some code to Rust from Python

So, I found rust about a year ago. My knowledge isn't the best, but I'm OK with it (I haven't read the book cover to cover, but have picked rust up through the book and through various other resources). I'm currently attempting to port a game engine a friend and I wrote in Python to Rust, primarily as an experiment (its very messy in Python, so if I release it, I'd most likely do a lot of cleanup first).

In Python we use a vars module to store global variables that must be accessed by the entire engine. (Messy, I know... I warned you. :)) These variables include the global sound system and various other variables that we needed constant access to at all times. It worked, and was easy to update, but definitely wasn't idiomatic. With that in mind, I'm trying to port the engine to Rust with the goal of having a fully working engine that's idiomatic and easy to update and modify and follows Rusts various philosophies. So, what would be the idiomatic way of sharing information across modules like that? Or is there a way I'm missing?

Finally, I really do like Rust. I have a couple web services I'm considering moving over to Rust, as well as a few other projects that I've got laying around to get more familiar with the language and its ways. I especially love how the compiler acts as a guardian of sorts and protects you from various mistakes that are ridiculously easy to make in other languages. Thank you for the language; I had tried learning functional concepts in languages like F# and I just couldn't understand it. But with Rust, I'm slowly grasping the idea of immutability and various other concepts that it brings to the table. (I primarily come from C/C++ -- which was the first language I learned -- so I originally was not very open to the idea that 'everything should be immutable', and patterns didn't make much sense at the time.)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.