• 1 Post
  • 2 Comments
Joined 1Y ago
cake
Cake day: Jun 10, 2023

help-circle
rss

The thing is, I also want to query all possible colors. And that would then be in a different function so I’d have to change two functions whenever I add a new color and I don’t like that.


I heard about this, but I wasn’t sure it was the right way. Or if Rust developers just straight up avoid situations like this.


How to create a block of static data
I want to create a global hash map that maps strings to vectors of colors. This data needs to be queried by multiple functions and should just be hard coded into the program. That doesn't seem possible. Now, how is the right (tm) way to do something like that in Rust? What if you need just a bunch of data structures from the beginning of the program until its end where some of the data needs to allocated?
fedilink