This commit contains autogenerated telepathy DBUS code and the output of `cargo new telepathy-delta`. It's pretty chill.
75 lines
2.6 KiB
Rust
75 lines
2.6 KiB
Rust
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Client_Approver.xml -i org.freedesktop.Telepathy -o src/telepathy/client_approver.rs`, see https://github.com/diwic/dbus-rs
|
|
use dbus;
|
|
use dbus::arg;
|
|
use dbus::tree;
|
|
|
|
pub trait ClientApprover {
|
|
fn add_dispatch_operation(
|
|
&self,
|
|
channels: Vec<(
|
|
dbus::Path,
|
|
::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
|
|
)>,
|
|
dispatch_operation: dbus::Path,
|
|
properties: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
|
|
) -> Result<(), tree::MethodErr>;
|
|
fn approver_channel_filter(
|
|
&self,
|
|
) -> Result<
|
|
Vec<::std::collections::HashMap<String, arg::Variant<Box<dyn arg::RefArg + 'static>>>>,
|
|
tree::MethodErr,
|
|
>;
|
|
}
|
|
|
|
pub fn client_approver_server<F, T, D>(
|
|
factory: &tree::Factory<tree::MTFn<D>, D>,
|
|
data: D::Interface,
|
|
f: F,
|
|
) -> tree::Interface<tree::MTFn<D>, D>
|
|
where
|
|
D: tree::DataType,
|
|
D::Method: Default,
|
|
D::Property: Default,
|
|
T: ClientApprover,
|
|
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
|
|
{
|
|
let i = factory.interface("org.freedesktop.Telepathy.Client.Approver", data);
|
|
let f = ::std::sync::Arc::new(f);
|
|
let fclone = f.clone();
|
|
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
|
|
let mut i = minfo.msg.iter_init();
|
|
let channels: Vec<(
|
|
dbus::Path,
|
|
::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
|
|
)> = i.read()?;
|
|
let dispatch_operation: dbus::Path = i.read()?;
|
|
let properties: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>> =
|
|
i.read()?;
|
|
let d = fclone(minfo);
|
|
d.add_dispatch_operation(channels, dispatch_operation, properties)?;
|
|
let rm = minfo.msg.method_return();
|
|
Ok(vec![rm])
|
|
};
|
|
let m = factory.method("AddDispatchOperation", Default::default(), h);
|
|
let m = m.in_arg(("Channels", "a(oa{sv})"));
|
|
let m = m.in_arg(("DispatchOperation", "o"));
|
|
let m = m.in_arg(("Properties", "a{sv}"));
|
|
let i = i.add_m(m);
|
|
|
|
let p = factory
|
|
.property::<Vec<::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>>, _>(
|
|
"ApproverChannelFilter",
|
|
Default::default(),
|
|
);
|
|
let p = p.access(tree::Access::Read);
|
|
let fclone = f.clone();
|
|
let p = p.on_get(move |a, pinfo| {
|
|
let minfo = pinfo.to_method_info();
|
|
let d = fclone(&minfo);
|
|
a.append(d.approver_channel_filter()?);
|
|
Ok(())
|
|
});
|
|
let i = i.add_p(p);
|
|
i
|
|
}
|