#const enummap
9 messages · Page 1 of 1 (latest)
This crate appears to be a very roundabout way to write a match statement, to be honest
Its internals don't appear to be declared const, so you can't use it in const, but you could just not use it at all
Oh wait, it's a proper mutable map
What's the intended use case? Stable const is rather limited, it may or may not be possible
I want to convert chess piece type to a string, to display and add some coloring to it
I also found this: https://kerkour.com/rust-enum-to-string, but I didn't tested it yet
The easiest way to do that would just be to match on it, yeah
It's possible to use EnumMap::from_array which is const fn
other than that, it's not possible to create const enum maps due to Rust limitations 😦