this post was submitted on 25 Jun 2023
6 points (100.0% liked)
Rust Programming
8140 readers
61 users here now
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Just make a function that
match
es string and outputs your colors. It’ll be faster and easier than any extra crate.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.
Then make a vector of colors, and make a function that
match
es string to index in that vector