-
-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I want to add support for TryFrom
in the ValueDelegate macro
Eg, I want to do this:
#[derive(ValueDelegate)]
#[value_delegate(try_from = u32)]
struct MyU16(u16);
Clearly, the conversion from a u32 to a u16 could fail.
FromValue::from_value
should return an error, else I can't return the error from the call of TryFrom::try_from
.
Currently FromValue
has an associated Checker
which checks the type in the glib type system and throws an error when the conversion is not possible. A Checker can't be made to handle TryFrom
though, because that would require calling try_from
inside FromValue::check
and FromValue::from_value
, which is a waste of resources.
Or maybe I just panic if TryFrom fails
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request