Use AsRefClosure when generating the bindings

This simplifies things significantly \o/
This commit is contained in:
2020-05-11 00:48:18 +01:00
parent ad0d95ab40
commit 9151f64a6d
126 changed files with 1633 additions and 1054 deletions

View File

@@ -1,4 +1,4 @@
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Connection_Interface_Contacts.xml -i org.freedesktop.Telepathy -o src/telepathy/connection_interface_contacts.rs`, see https://github.com/diwic/dbus-rs
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Connection_Interface_Contacts.xml -i org.freedesktop.Telepathy -a AsRefClosure -o src/telepathy/connection_interface_contacts.rs`, see https://github.com/diwic/dbus-rs
use dbus;
use dbus::arg;
use dbus::tree;
@@ -39,8 +39,8 @@ where
D: tree::DataType,
D::Method: Default,
D::Property: Default,
T: ConnectionInterfaceContacts,
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
T: AsRef<dyn ConnectionInterfaceContacts>,
F: 'static + Fn(&tree::MethodInfo<tree::MTFn<D>, D>) -> T,
{
let i = factory.interface(
"org.freedesktop.Telepathy.Connection.Interface.Contacts",
@@ -53,7 +53,8 @@ where
let handles: Vec<u32> = i.read()?;
let interfaces: Vec<&str> = i.read()?;
let hold: bool = i.read()?;
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
let attributes = d.get_contact_attributes(handles, interfaces, hold)?;
let rm = minfo.msg.method_return();
let rm = rm.append1(attributes);
@@ -71,7 +72,8 @@ where
let mut i = minfo.msg.iter_init();
let identifier: &str = i.read()?;
let interfaces: Vec<&str> = i.read()?;
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
let (handle, attributes) = d.get_contact_by_id(identifier, interfaces)?;
let rm = minfo.msg.method_return();
let rm = rm.append1(handle);
@@ -90,7 +92,8 @@ where
let fclone = f.clone();
let p = p.on_get(move |a, pinfo| {
let minfo = pinfo.to_method_info();
let d = fclone(&minfo);
let dd = fclone(&minfo);
let d = dd.as_ref();
a.append(d.contact_attribute_interfaces()?);
Ok(())
});