What is the correct way to set the value of an anonymous struct property on the rust side? #2650
-
The setter method to set the anonymous struct takes an tuple as input, while the order of the tuple elements doesn't seem to correspond to the order of the anonymous struct that I defined in the slint file. How to correctly set the value of an anonymous struct? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hm, where do you run into this anonymous struct? |
Beta Was this translation helpful? Give feedback.
-
I assume you mean something like this
Then is indeed an anonymous struct in the native language. And the order is the alphabetical order of the fields. I think the best would be to declare an actual struct:
Then you have a non-annonymous struct that should be easier to handle. |
Beta Was this translation helpful? Give feedback.
I assume you mean something like this
Then is indeed an anonymous struct in the native language. And the order is the alphabetical order of the fields.
It's like that for technical reason, because the type information doesn't have the exact order (although we could fix that) but then it would be a breaking change.
I think the best would be to declare an actual struct:
Then you have a non-annonymous struct that should be easier to handle.