Sometimes, there's the need to have a way to inspect and change some values at runtime (for example via a combobox with egui, like in games or other similar software) and for enum
s it is possible to do it either manually or by using some derive from third-party crates.
The issue is that it isn't possible to do it with enum
s defined in third-party crates. The only workaround is to create another enum that provides this mapping manually.
I have seen some previous discussion regarding compile-time reflection but I don't know if there is any progress on that front.
It would be nice to have a (experimental, without any stability guarantee at the moment?) official way to access the (at least only the nullary) variants of any enum to be able to obtain a string and a lambda to create the variant, like for example a const method (or a macro) that returns [(&'static str, Fn() -> T)]
.