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/Channel_Interface_Anonymity.xml -i org.freedesktop.Telepathy -o src/telepathy/channel_interface_anonymity.rs`, see https://github.com/diwic/dbus-rs
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Channel_Interface_Anonymity.xml -i org.freedesktop.Telepathy -a AsRefClosure -o src/telepathy/channel_interface_anonymity.rs`, see https://github.com/diwic/dbus-rs
use dbus;
use dbus::arg;
use dbus::tree;
@@ -18,8 +18,8 @@ where
D: tree::DataType,
D::Method: Default,
D::Property: Default,
T: ChannelInterfaceAnonymity,
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
T: AsRef<dyn ChannelInterfaceAnonymity>,
F: 'static + Fn(&tree::MethodInfo<tree::MTFn<D>, D>) -> T,
{
let i = factory.interface(
"org.freedesktop.Telepathy.Channel.Interface.Anonymity",
@@ -31,7 +31,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.anonymity_modes()?);
Ok(())
});
@@ -42,7 +43,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.anonymity_mandatory()?);
Ok(())
});
@@ -53,7 +55,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.anonymous_id()?);
Ok(())
});