There is no need for a HashMap to only store something known on compile-time. It's possible to use a Perfech Hash Function, but there is no need for that either, since strings are pretty small and easy to compare. I used a small function, that should probably be migrated to an enumeration as per #6.
Also, note that my editor runs cargo fmt by default, so it formats the whole code. Let me know if this is not OK, and I can edit it without running it.
There is no need for a
HashMap
to only store something known on compile-time. It's possible to use a Perfech Hash Function, but there is no need for that either, since strings are pretty small and easy to compare. I used a small function, that should probably be migrated to an enumeration as per #6.Also, note that my editor runs
cargo fmt
by default, so it formats the whole code. Let me know if this is not OK, and I can edit it without running it.