Open dorukotiv opened 1 day ago
I don't feel very comfortable with this. Other programming languages don't do this typically out of the box with enums and use reflection instead. And to make matters worse: this doesn't play well with translations.
Perhaps we need a way to more easily create mappings? Like a match on an enum that errors when not all variants are covered.
(in case you didn't know, it is converting to string for debugging purpose using the debug(...)
function to print value in the console)
You can use @rust-attr
to derive from one of the crate that provide enum-to-string conversion in rust for the exported rust enum.
But I agree with @tronical that this is not necessarily a good idea to have that in Slint itself.
Feature Description
Currently, an enum that is defined in slint can not be given to the Text component as an input, a callback needs to be implemented in Rust to do the conversion.
Ideally, I would directly use the enum text as an input to the text.
Example:
that would be seen as "Right" on the screen.
Product Impact
We are a railway company building Remote Supervision Control Desktop application for a locomotive.
It would reduce the code and time.