this post was submitted on 25 Jun 2023
6 points (100.0% liked)

Rust Programming

8172 readers
20 users here now

founded 5 years ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] PrincipleOfCharity@0v0.social 6 points 1 year ago* (last edited 1 year ago)

Is the hash map immutable? If so, look at the rust-phf crate.