nm_rs/auto/
dns_entry.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{ffi};
7use glib::{translate::*};
8
9glib::wrapper! {
10    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11    pub struct DnsEntry(Boxed<ffi::NMDnsEntry>);
12
13    match fn {
14        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::nm_dns_entry_get_type(), ptr as *mut _) as *mut ffi::NMDnsEntry,
15        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::nm_dns_entry_get_type(), ptr as *mut _),
16        type_ => || ffi::nm_dns_entry_get_type(),
17    }
18}
19
20impl DnsEntry {
21    /// Gets the list of DNS domains.
22    ///
23    /// # Returns
24    ///
25    /// the list of DNS domains
26    #[doc(alias = "nm_dns_entry_get_domains")]
27    #[doc(alias = "get_domains")]
28    pub fn domains(&mut self) -> Vec<glib::GString> {
29        unsafe {
30            FromGlibPtrContainer::from_glib_none(ffi::nm_dns_entry_get_domains(self.to_glib_none_mut().0))
31        }
32    }
33
34    /// Gets the interface on which name servers are contacted.
35    ///
36    /// # Returns
37    ///
38    /// the interface name
39    #[doc(alias = "nm_dns_entry_get_interface")]
40    #[doc(alias = "get_interface")]
41    pub fn interface(&mut self) -> glib::GString {
42        unsafe {
43            from_glib_none(ffi::nm_dns_entry_get_interface(self.to_glib_none_mut().0))
44        }
45    }
46
47    /// Gets the list of name servers for this entry.
48    ///
49    /// # Returns
50    ///
51    /// the list of name servers
52    #[doc(alias = "nm_dns_entry_get_nameservers")]
53    #[doc(alias = "get_nameservers")]
54    pub fn nameservers(&mut self) -> Vec<glib::GString> {
55        unsafe {
56            FromGlibPtrContainer::from_glib_none(ffi::nm_dns_entry_get_nameservers(self.to_glib_none_mut().0))
57        }
58    }
59
60    /// Gets the priority of the entry
61    ///
62    /// # Returns
63    ///
64    /// the priority of the entry
65    #[doc(alias = "nm_dns_entry_get_priority")]
66    #[doc(alias = "get_priority")]
67    pub fn priority(&mut self) -> i32 {
68        unsafe {
69            ffi::nm_dns_entry_get_priority(self.to_glib_none_mut().0)
70        }
71    }
72
73    /// Gets whether the entry refers to VPN name servers.
74    ///
75    /// # Returns
76    ///
77    /// [`true`] if the entry refers to VPN name servers
78    #[doc(alias = "nm_dns_entry_get_vpn")]
79    #[doc(alias = "get_vpn")]
80    pub fn is_vpn(&mut self) -> bool {
81        unsafe {
82            from_glib(ffi::nm_dns_entry_get_vpn(self.to_glib_none_mut().0))
83        }
84    }
85}