mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 20:31:27 +00:00
Document how SetPropertyError::WrongType can be produced when assigning structs
Closes #3210
This commit is contained in:
parent
541e7137c6
commit
3ea9c6249f
1 changed files with 8 additions and 4 deletions
|
|
@ -872,7 +872,7 @@ impl ComponentInstance {
|
|||
.map_err(|()| GetPropertyError::NoSuchProperty)
|
||||
}
|
||||
|
||||
/// Set the value for a public property of this component
|
||||
/// Set the value for a public property of this component.
|
||||
pub fn set_property(&self, name: &str, value: Value) -> Result<(), SetPropertyError> {
|
||||
let name = normalize_identifier(name);
|
||||
generativity::make_guard!(guard);
|
||||
|
|
@ -1188,13 +1188,17 @@ pub enum GetPropertyError {
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum SetPropertyError {
|
||||
/// There is no property with the given name
|
||||
/// There is no property with the given name.
|
||||
#[error("no such property")]
|
||||
NoSuchProperty,
|
||||
/// The property exist but does not have a type matching the dynamic value
|
||||
/// The property exists but does not have a type matching the dynamic value.
|
||||
///
|
||||
/// This happens for example when assigning a source struct value to a target
|
||||
/// struct property, where the source doesn't have all the fields the target struct
|
||||
/// requires.
|
||||
#[error("wrong type")]
|
||||
WrongType,
|
||||
/// Attempt to set an output property
|
||||
/// Attempt to set an output property.
|
||||
#[error("access denied")]
|
||||
AccessDenied,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue