#![allow(clippy::all)] // This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Connection_Interface_Contacts.xml -i org.freedesktop.Telepathy -a AsRefClosure -o src/telepathy/connection_interface_contacts.rs`, see https://github.com/diwic/dbus-rs use dbus; use dbus::arg; use dbus::tree; pub trait ConnectionInterfaceContacts { fn get_contact_attributes( &self, handles: Vec, interfaces: Vec<&str>, hold: bool, ) -> Result< ::std::collections::HashMap< u32, ::std::collections::HashMap>>, >, tree::MethodErr, >; fn get_contact_by_id( &self, identifier: &str, interfaces: Vec<&str>, ) -> Result< ( u32, ::std::collections::HashMap>>, ), tree::MethodErr, >; fn contact_attribute_interfaces(&self) -> Result, tree::MethodErr>; } pub fn connection_interface_contacts_server( factory: &tree::Factory, D>, data: D::Interface, f: F, ) -> tree::Interface, D> where D: tree::DataType, D::Method: Default, D::Property: Default, T: AsRef, F: 'static + Fn(&tree::MethodInfo, D>) -> T, { let i = factory.interface( "org.freedesktop.Telepathy.Connection.Interface.Contacts", data, ); let f = ::std::sync::Arc::new(f); let fclone = f.clone(); let h = move |minfo: &tree::MethodInfo, D>| { let mut i = minfo.msg.iter_init(); let handles: Vec = i.read()?; let interfaces: Vec<&str> = i.read()?; let hold: bool = i.read()?; let dd = fclone(minfo); let d = dd.as_ref(); let attributes = d.get_contact_attributes(handles, interfaces, hold)?; let rm = minfo.msg.method_return(); let rm = rm.append1(attributes); Ok(vec![rm]) }; let m = factory.method("GetContactAttributes", Default::default(), h); let m = m.in_arg(("Handles", "au")); let m = m.in_arg(("Interfaces", "as")); let m = m.in_arg(("Hold", "b")); let m = m.out_arg(("Attributes", "a{ua{sv}}")); let i = i.add_m(m); let fclone = f.clone(); let h = move |minfo: &tree::MethodInfo, D>| { let mut i = minfo.msg.iter_init(); let identifier: &str = i.read()?; let interfaces: Vec<&str> = i.read()?; let dd = fclone(minfo); let d = dd.as_ref(); let (handle, attributes) = d.get_contact_by_id(identifier, interfaces)?; let rm = minfo.msg.method_return(); let rm = rm.append1(handle); let rm = rm.append1(attributes); Ok(vec![rm]) }; let m = factory.method("GetContactByID", Default::default(), h); let m = m.in_arg(("Identifier", "s")); let m = m.in_arg(("Interfaces", "as")); let m = m.out_arg(("Handle", "u")); let m = m.out_arg(("Attributes", "a{sv}")); let i = i.add_m(m); let p = factory.property::, _>("ContactAttributeInterfaces", 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 dd = fclone(&minfo); let d = dd.as_ref(); a.append(d.contact_attribute_interfaces()?); Ok(()) }); let i = i.add_p(p); i }