You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be good to have a value type check for characteristics in some way
Now a characteristic value only has to be of a Json Value type but that does allow the user to set a bool where the specification excepts a number, resulting in a panic
The text was updated successfully, but these errors were encountered:
Would it be an idea to change the argument type to the unit type that the characteristic expects, and then have your template generate the Value structure inside of the set_value function?
That way you can still have all the generics, but the end user will know exactly what value is expected here and code analyzer will notify them of this as well?
It could also make your template have the unit shown in the documentation. This would make each accessory file have different arguments for this function but it would surely make things more clearer?
Something like:
///This function accepts a bool async fn set_value(&mut self, value: bool) -> Result<()> { HapCharacteristic::set_value(&mut self.0, json!(value)).await }
I think it would be good to have a value type check for characteristics in some way
Now a characteristic value only has to be of a Json Value type but that does allow the user to set a bool where the specification excepts a number, resulting in a panic
The text was updated successfully, but these errors were encountered: