I’m starting learning Rust. So don’t judge me too quickly.
I’m trying to create a generic method that get data from dbus. To do that, I’m using the zbus crate.
Deserializing the dbus return message always give me an issue.
pub async fn basic_getter<'a, T>(
serial: String,
interface: String,
method: String,
) -> Result<T, zbus::Error>
where
T: zbus::zvariant::DynamicDeserialize<'a>,
{
let connection = Connection::session().await?;
let out_body = &();
let m = connection
.call_method(
Some("org.razer"),
build_device_path(serial),
Some(interface),
method,
out_body,
)
.await?;
let reply = m.body().deserialize::<'a, T>()?; // temporary value dropped while borrowed
Ok(reply)
}
`
To be honest, I’m not sure how I can get rid off that issue.
Please, all comment and help are welcome.
New contributor
GEOFFREY BAUDIN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.