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_Dispatcher.xml -i org.freedesktop.Telepathy -o src/telepathy/channel_dispatcher.rs`, see https://github.com/diwic/dbus-rs
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Channel_Dispatcher.xml -i org.freedesktop.Telepathy -a AsRefClosure -o src/telepathy/channel_dispatcher.rs`, see https://github.com/diwic/dbus-rs
use dbus;
use dbus::arg;
use dbus::tree;
@@ -64,8 +64,8 @@ where
D: tree::DataType,
D::Method: Default,
D::Property: Default,
T: ChannelDispatcher,
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
T: AsRef<dyn ChannelDispatcher>,
F: 'static + Fn(&tree::MethodInfo<tree::MTFn<D>, D>) -> T,
{
let i = factory.interface("org.freedesktop.Telepathy.ChannelDispatcher", data);
let f = ::std::sync::Arc::new(f);
@@ -79,7 +79,8 @@ where
> = i.read()?;
let user_action_time: i64 = i.read()?;
let preferred_handler: &str = i.read()?;
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
let request = d.create_channel(
account,
requested_properties,
@@ -108,7 +109,8 @@ where
> = i.read()?;
let user_action_time: i64 = i.read()?;
let preferred_handler: &str = i.read()?;
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
let request = d.ensure_channel(
account,
requested_properties,
@@ -139,7 +141,8 @@ where
let preferred_handler: &str = i.read()?;
let hints: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>> =
i.read()?;
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
let request = d.create_channel_with_hints(
account,
requested_properties,
@@ -172,7 +175,8 @@ where
let preferred_handler: &str = i.read()?;
let hints: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>> =
i.read()?;
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
let request = d.ensure_channel_with_hints(
account,
requested_properties,
@@ -199,7 +203,8 @@ where
let channels: Vec<dbus::Path> = i.read()?;
let user_action_time: i64 = i.read()?;
let preferred_handler: &str = i.read()?;
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
let (delegated, not_delegated) =
d.delegate_channels(channels, user_action_time, preferred_handler)?;
let rm = minfo.msg.method_return();
@@ -220,7 +225,8 @@ where
let mut i = minfo.msg.iter_init();
let channel: dbus::Path = i.read()?;
let user_action_time: i64 = i.read()?;
let d = fclone(minfo);
let dd = fclone(minfo);
let d = dd.as_ref();
d.present_channel(channel, user_action_time)?;
let rm = minfo.msg.method_return();
Ok(vec![rm])
@@ -235,7 +241,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.interfaces()?);
Ok(())
});
@@ -246,7 +253,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.supports_request_hints()?);
Ok(())
});