zbus-old
zbus-old copied to clipboard
`dbus_proxy` macro should allow parsing of response body into unowned types
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.
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.
marked #106 as a duplicate of this issue
marked this issue as related to #106
In GitLab by @Spider on Nov 24, 2020, 18:27
Thanks!
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<'_>>;
}