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_Media_Signalling.xml -i org.freedesktop.Telepathy -o src/telepathy/channel_interface_media_signalling.rs`, see https://github.com/diwic/dbus-rs
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Channel_Interface_Media_Signalling.xml -i org.freedesktop.Telepathy -a AsRefClosure -o src/telepathy/channel_interface_media_signalling.rs`, see https://github.com/diwic/dbus-rs
use dbus;
use dbus::arg;
use dbus::tree;
@@ -16,8 +16,8 @@ where
D: tree::DataType,
D::Method: Default,
D::Signal: Default,
T: ChannelInterfaceMediaSignalling,
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
T: AsRef<dyn ChannelInterfaceMediaSignalling>,
F: 'static + Fn(&tree::MethodInfo<tree::MTFn<D>, D>) -> T,
{
let i = factory.interface(
"org.freedesktop.Telepathy.Channel.Interface.MediaSignalling",
@@ -26,7 +26,8 @@ where
let f = ::std::sync::Arc::new(f);
let fclone = f.clone();
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
let session_handlers = d.get_session_handlers()?;
let rm = minfo.msg.method_return();
let rm = rm.append1(session_handlers);