Conversation
|
I like the idea. Did you consider There are quite a lot of Clippy errors BTW. |
|
Using Where do you see the Clippy errors? Locally, there are none showing up for me, and in CI, there are also none… |
|
In preparation for better page creation and support for page property updates, the structure of properties has to change more fundamentally. This, unfortunately, also includes breaking changes. I currently see no way around this. The problem is that page creation or updating doesn't need the ID inside a property variant; it just needs the property value. The new, more flexible structure solves this and also makes the code more concise in other cases. I also removed the custom |
This is kind of a bigger one.
I always found it pretty annoying to access a property value and hard to debug when you got something wrong. It wasn't possible to access a property by ID.
So this first of all adds
get_by_nameandget_by_idto thePropertiesstruct.To make it easier to access the values of a property in cases where you know the property type or expect a specific property type, this adds the
FromPropertyValuetrait and a bunch of convenience methods.The trait also allows the user to define a specific type in which they want to receive the value of a property.
For easy access to the boolean state of a checkbox property, the following boilerplate was necessary, and you still had annoying error handling.
The above code can now be done as follows:
Example using the trait for a custom type:
I've found this very useful in my application where I have to access a lot of properties. But it is, of course, a larger addition. Let me know what you think.