Skip to content

zm: prop setter to allow non-ref value arg

Zeeshan Ali Khan requested to merge zeenix/zbus:prop-setter-by-value into main

We now handle 3 different types of property value types of setters differently:

  • For reference arg, we convert from &Value (so TryFrom<&Value<'_>> is required). i-e same as before this change.
  • For argument type with lifetimes, we convert from Value (so TryFrom<Value<'_>> is required).
  • For all other arg types, we convert the passed value to OwnedValue first and then pass it as Value (so TryFrom<Value<'static>> is required). This implies possible implicit allocation/cloning but what can we do. 🤷

The last 2 make this (at least in theory) a breaking change. I'm not sure if it practically matters as we've only received two reports of #248 (closed), which is much lower than expected if a lot of folks are using custom types for prop setter.

Fixes #248 (closed).

Edited by Zeeshan Ali Khan

Merge request reports

Loading