Allow interface properties to receive `#[zbus(...)]` parameters
Hello, To implement some interface properties, I must have access to the connection that received the call in order to build the reply. Here is an example:
#[dbus_interface(name = "org.a11y.atspi.Accessible")]
impl<T> AccessibleInterfaceObject<T>
where T: AccessibleInterface + Send + Sync + 'static
{
#[dbus_interface(property)]
fn parent(
&self,
#[zbus(connection)] connection: Connection
) -> ObjectAddress {
let bus_name = connection.unique_name.unwrap();
if let Some(parent) = self.0.parent() {
ObjectAddress::accessible(bus_name, parent)
} else {
ObjectAddress::null(bus_name)
}
}
}
This is currently not allowed, and results in an error message:
error: custom attribute panicked
--> platforms/linux/src/atspi/interfaces/accessible.rs:30:1
|
30 | #[dbus_interface(name = "org.a11y.atspi.Accessible")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: message: assertion failed: name.starts_with(\"set_\")
As stated in the macro documentation, property getters must not take any argument, and setters must only take the new value. It would be nice however, if arguments marked with #[zbus(...)]
were allowed.