zbus-old icon indicating copy to clipboard operation
zbus-old copied to clipboard

`dbus_proxy` macro should allow parsing of response body into unowned types

Open zeenix opened this issue 5 years ago • 5 comments
trafficstars

This is very similar to #34 but for dbus_proxy macro. While most users will be OK with owned values in response, in the generated code and they can always use hand-coded calls instead if they need unowned, it would still be good to support this use case in the generated code.

zeenix avatar Jul 07 '20 21:07 zeenix

I looked into this yesterday a bit and it's not so easy because of the approach we took with #34. The issue is the ownership of the response message when we are returning a possible ref into it. For now, I think we should simply provide access to the underlying zbus::Proxy (see #64), which allows user to then do it more manually using zbus::Proxy::call_method.

zeenix avatar Aug 04 '20 10:08 zeenix

marked #106 as a duplicate of this issue

zeenix avatar Nov 24 '20 17:11 zeenix

marked this issue as related to #106

zeenix avatar Nov 24 '20 17:11 zeenix

In GitLab by @Spider on Nov 24, 2020, 18:27

Thanks!

zeenix avatar Nov 24 '20 17:11 zeenix

I think we need to do something like what I suggested here. An attribute would be required for users to signal to the macro that that's what they want:

#[dbus_proxy(
    default_service = "org.freedesktop.GeoClue2",
    interface = "org.freedesktop.GeoClue2.Manager",
    default_path = "/org/freedesktop/GeoClue2/Manager"
)]
trait Manager {
    #[dbus_proxy(unowned_return)]
    fn get_client(&self) -> Result<ObjectPath<'_>>;
}

zeenix avatar Feb 18 '21 14:02 zeenix