Files
telepathy-padfoot/src/telepathy/channel_interface_service_point.rs
Nick Thomas 3d44ce6b3d Initial checkin
This commit contains autogenerated telepathy DBUS code and the output
of `cargo new telepathy-delta`. It's pretty chill.
2020-05-08 20:38:30 +01:00

79 lines
2.7 KiB
Rust

// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Channel_Interface_Service_Point.xml -i org.freedesktop.Telepathy -o src/telepathy/channel_interface_service_point.rs`, see https://github.com/diwic/dbus-rs
use dbus;
use dbus::arg;
use dbus::tree;
pub trait ChannelInterfaceServicePoint {
fn initial_service_point(&self) -> Result<(u32, String), tree::MethodErr>;
fn current_service_point(&self) -> Result<(u32, String), tree::MethodErr>;
}
pub fn channel_interface_service_point_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,
D::Signal: Default,
T: ChannelInterfaceServicePoint,
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
{
let i = factory.interface(
"org.freedesktop.Telepathy.Channel.Interface.ServicePoint",
data,
);
let f = ::std::sync::Arc::new(f);
let p = factory.property::<(u32, &str), _>("InitialServicePoint", 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.initial_service_point()?);
Ok(())
});
let i = i.add_p(p);
let p = factory.property::<(u32, &str), _>("CurrentServicePoint", 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.current_service_point()?);
Ok(())
});
let i = i.add_p(p);
let s = factory.signal("ServicePointChanged", Default::default());
let s = s.arg(("Service_Point", "(us)"));
let i = i.add_s(s);
i
}
#[derive(Debug)]
pub struct ChannelInterfaceServicePointServicePointChanged {
pub service_point: (u32, String),
}
impl arg::AppendAll for ChannelInterfaceServicePointServicePointChanged {
fn append(&self, i: &mut arg::IterAppend) {
arg::RefArg::append(&self.service_point, i);
}
}
impl arg::ReadAll for ChannelInterfaceServicePointServicePointChanged {
fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
Ok(ChannelInterfaceServicePointServicePointChanged {
service_point: i.read()?,
})
}
}
impl dbus::message::SignalArgs for ChannelInterfaceServicePointServicePointChanged {
const NAME: &'static str = "ServicePointChanged";
const INTERFACE: &'static str = "org.freedesktop.Telepathy.Channel.Interface.ServicePoint";
}