gio/auto/dbus_node_info.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{DBusInterfaceInfo, ffi};
6use glib::translate::*;
7
8glib::wrapper! {
9 /// Information about nodes in a remote object hierarchy.
10 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11 pub struct DBusNodeInfo(Shared<ffi::GDBusNodeInfo>);
12
13 match fn {
14 ref => |ptr| ffi::g_dbus_node_info_ref(ptr),
15 unref => |ptr| ffi::g_dbus_node_info_unref(ptr),
16 type_ => || ffi::g_dbus_node_info_get_type(),
17 }
18}
19
20impl DBusNodeInfo {
21 /// ` element.
22 ///
23 /// Note that this routine is using a
24 /// [GMarkup](../glib/markup.html)-based
25 /// parser that only accepts a subset of valid XML documents.
26 /// ## `xml_data`
27 /// Valid D-Bus introspection XML.
28 ///
29 /// # Returns
30 ///
31 /// A #GDBusNodeInfo structure or [`None`] if @error is set. Free
32 /// with g_dbus_node_info_unref().
33 #[doc(alias = "g_dbus_node_info_new_for_xml")]
34 #[doc(alias = "new_for_xml")]
35 pub fn for_xml(xml_data: &str) -> Result<DBusNodeInfo, glib::Error> {
36 unsafe {
37 let mut error = std::ptr::null_mut();
38 let ret = ffi::g_dbus_node_info_new_for_xml(xml_data.to_glib_none().0, &mut error);
39 if error.is_null() {
40 Ok(from_glib_full(ret))
41 } else {
42 Err(from_glib_full(error))
43 }
44 }
45 }
46
47 //#[doc(alias = "g_dbus_node_info_generate_xml")]
48 //pub fn generate_xml(&self, indent: u32, string_builder: /*Ignored*/&mut glib::String) {
49 // unsafe { TODO: call ffi:g_dbus_node_info_generate_xml() }
50 //}
51
52 /// Looks up information about an interface.
53 ///
54 /// The cost of this function is O(n) in number of interfaces.
55 /// ## `name`
56 /// A D-Bus interface name.
57 ///
58 /// # Returns
59 ///
60 /// A #GDBusInterfaceInfo or [`None`] if not found. Do not free, it is owned by @self.
61 #[doc(alias = "g_dbus_node_info_lookup_interface")]
62 pub fn lookup_interface(&self, name: &str) -> Option<DBusInterfaceInfo> {
63 unsafe {
64 from_glib_none(ffi::g_dbus_node_info_lookup_interface(
65 self.to_glib_none().0,
66 name.to_glib_none().0,
67 ))
68 }
69 }
70}