nm_rs/auto/
device_infiniband.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#![allow(deprecated)]
6
7use crate::{ffi,Device,Object};
8use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
9use std::{boxed::Box as Box_};
10
11glib::wrapper! {
12    ///
13    ///
14    /// ## Properties
15    ///
16    ///
17    /// #### `carrier`
18    ///  Whether the device has carrier.
19    ///
20    /// Readable
21    /// <details><summary><h4>Device</h4></summary>
22    ///
23    ///
24    /// #### `active-connection`
25    ///  The #NMActiveConnection object that "owns" this device during activation.
26    ///
27    /// Readable
28    ///
29    ///
30    /// #### `autoconnect`
31    ///  Whether the device can auto-activate a connection.
32    ///
33    /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
34    ///
35    /// Readable | Writeable
36    ///
37    ///
38    /// #### `available-connections`
39    ///  The available connections of the device
40    ///
41    /// Readable
42    ///
43    ///
44    /// #### `capabilities`
45    ///  The capabilities of the device.
46    ///
47    /// Readable
48    ///
49    ///
50    /// #### `device-type`
51    ///  The numeric type of the device.
52    ///
53    /// Readable
54    ///
55    ///
56    /// #### `dhcp4-config`
57    ///  The IPv4 #NMDhcpConfig of the device.
58    ///
59    /// Readable
60    ///
61    ///
62    /// #### `dhcp6-config`
63    ///  The IPv6 #NMDhcpConfig of the device.
64    ///
65    /// Readable
66    ///
67    ///
68    /// #### `driver`
69    ///  The driver of the device.
70    ///
71    /// Readable
72    ///
73    ///
74    /// #### `driver-version`
75    ///  The version of the device driver.
76    ///
77    /// Readable
78    ///
79    ///
80    /// #### `firmware-missing`
81    ///  When [`true`] indicates the device is likely missing firmware required
82    /// for its operation.
83    ///
84    /// Readable
85    ///
86    ///
87    /// #### `firmware-version`
88    ///  The firmware version of the device.
89    ///
90    /// Readable
91    ///
92    ///
93    /// #### `hw-address`
94    ///  The hardware address of the device.
95    ///
96    /// Readable
97    ///
98    ///
99    /// #### `interface`
100    ///  The interface of the device.
101    ///
102    /// Readable
103    ///
104    ///
105    /// #### `interface-flags`
106    ///  The interface flags.
107    ///
108    /// Readable
109    ///
110    ///
111    /// #### `ip-interface`
112    ///  The IP interface of the device which should be used for all IP-related
113    /// operations like addressing and routing.
114    ///
115    /// Readable
116    ///
117    ///
118    /// #### `ip4-config`
119    ///  The #NMIP4Config of the device.
120    ///
121    /// Readable
122    ///
123    ///
124    /// #### `ip4-connectivity`
125    ///  The IPv4 connectivity state of the device.
126    ///
127    /// Readable
128    ///
129    ///
130    /// #### `ip6-config`
131    ///  The IPv6 #NMIPConfig of the device.
132    ///
133    /// Readable
134    ///
135    ///
136    /// #### `ip6-connectivity`
137    ///  The IPv6 connectivity state of the device.
138    ///
139    /// Readable
140    ///
141    ///
142    /// #### `lldp-neighbors`
143    ///  The LLDP neighbors.
144    ///
145    /// Readable
146    ///
147    ///
148    /// #### `managed`
149    ///  Whether the device is managed by NetworkManager.
150    ///
151    /// Readable
152    ///
153    ///
154    /// #### `metered`
155    ///  Whether the device is metered.
156    ///
157    /// Readable
158    ///
159    ///
160    /// #### `mtu`
161    ///  The MTU of the device.
162    ///
163    /// Readable
164    ///
165    ///
166    /// #### `nm-plugin-missing`
167    ///  When [`true`] indicates that the NetworkManager plugin for the device
168    /// is not installed.
169    ///
170    /// Readable
171    ///
172    ///
173    /// #### `path`
174    ///  The device path as exposed by the udev property ID_PATH.
175    ///
176    /// The string is backslash escaped (C escaping) for invalid
177    /// characters. The escaping can be reverted with g_strcompress(),
178    /// however the result may not be valid UTF-8.
179    ///
180    /// Readable
181    ///
182    ///
183    /// #### `physical-port-id`
184    ///  The physical port ID of the device. (See
185    /// nm_device_get_physical_port_id().)
186    ///
187    /// Readable
188    ///
189    ///
190    /// #### `ports`
191    ///  The port devices of the controller device. For devices that cannot be
192    /// controllers this is likely to be always empty.
193    ///
194    /// Readable
195    ///
196    ///
197    /// #### `product`
198    ///  The product string of the device.
199    ///
200    /// Readable
201    ///
202    ///
203    /// #### `real`
204    ///  Whether the device is real or is a placeholder device that could
205    /// be created automatically by NetworkManager if one of its
206    /// #NMDevice:available-connections was activated.
207    ///
208    /// Readable
209    ///
210    ///
211    /// #### `state`
212    ///  The state of the device.
213    ///
214    /// Readable
215    ///
216    ///
217    /// #### `state-reason`
218    ///  The reason for the device state.
219    ///
220    /// Readable
221    ///
222    ///
223    /// #### `udi`
224    ///  An operating-system specific device hardware identifier; this is not
225    /// unique to a specific hardware device across reboots or hotplugs.  It
226    /// is an opaque string which for some device types (Bluetooth, Modem)
227    /// contains an identifier provided by the underlying hardware service daemon
228    /// such as Bluez or ModemManager, and clients can use this property to
229    /// request more information about the device from those services.
230    ///
231    /// Readable
232    ///
233    ///
234    /// #### `vendor`
235    ///  The vendor string of the device.
236    ///
237    /// Readable
238    /// </details>
239    /// <details><summary><h4>Object</h4></summary>
240    ///
241    ///
242    /// #### `client`
243    ///  The NMClient instance as returned by nm_object_get_client().
244    ///
245    /// When an NMObject gets removed from the NMClient cache,
246    /// the NMObject:path property stays unchanged, but this client
247    /// instance gets reset to [`None`]. You can use this property to
248    /// track removal of the object from the cache.
249    ///
250    /// Readable
251    ///
252    ///
253    /// #### `path`
254    ///  The D-Bus object path.
255    ///
256    /// The D-Bus path of an object instance never changes, even if the object
257    /// gets removed from the cache. To see whether the object is still in the
258    /// cache, check NMObject:client.
259    ///
260    /// Readable
261    /// </details>
262    ///
263    /// # Implements
264    ///
265    /// [`DeviceExt`][trait@crate::prelude::DeviceExt], [`ObjectExt`][trait@crate::prelude::ObjectExt]
266    #[doc(alias = "NMDeviceInfiniband")]
267    pub struct DeviceInfiniband(Object<ffi::NMDeviceInfiniband, ffi::NMDeviceInfinibandClass>) @extends Device, Object;
268
269    match fn {
270        type_ => || ffi::nm_device_infiniband_get_type(),
271    }
272}
273
274impl DeviceInfiniband {
275            // rustdoc-stripper-ignore-next
276            /// Creates a new builder-pattern struct instance to construct [`DeviceInfiniband`] objects.
277            ///
278            /// This method returns an instance of [`DeviceInfinibandBuilder`](crate::builders::DeviceInfinibandBuilder) which can be used to create [`DeviceInfiniband`] objects.
279            pub fn builder() -> DeviceInfinibandBuilder {
280                DeviceInfinibandBuilder::new()
281            }
282        
283
284    /// Whether the device has carrier.
285    ///
286    /// # Returns
287    ///
288    /// [`true`] if the device has carrier
289    #[doc(alias = "nm_device_infiniband_get_carrier")]
290    #[doc(alias = "get_carrier")]
291    #[doc(alias = "carrier")]
292    pub fn is_carrier(&self) -> bool {
293        unsafe {
294            from_glib(ffi::nm_device_infiniband_get_carrier(self.to_glib_none().0))
295        }
296    }
297
298    /// Gets the hardware (MAC) address of the #NMDeviceInfiniband
299    ///
300    /// # Deprecated since 1.24
301    ///
302    /// Use nm_device_get_hw_address() instead.
303    ///
304    /// # Returns
305    ///
306    /// the hardware address. This is the internal string used by the
307    /// device, and must not be modified.
308    #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
309    #[allow(deprecated)]
310    #[doc(alias = "nm_device_infiniband_get_hw_address")]
311    #[doc(alias = "get_hw_address")]
312    pub fn hw_address(&self) -> glib::GString {
313        unsafe {
314            from_glib_none(ffi::nm_device_infiniband_get_hw_address(self.to_glib_none().0))
315        }
316    }
317
318    #[doc(alias = "carrier")]
319    pub fn connect_carrier_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
320        unsafe extern "C" fn notify_carrier_trampoline<F: Fn(&DeviceInfiniband) + 'static>(this: *mut ffi::NMDeviceInfiniband, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
321            let f: &F = &*(f as *const F);
322            f(&from_glib_borrow(this))
323        }
324        unsafe {
325            let f: Box_<F> = Box_::new(f);
326            connect_raw(self.as_ptr() as *mut _, c"notify::carrier".as_ptr() as *const _,
327                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_carrier_trampoline::<F> as *const ())), Box_::into_raw(f))
328        }
329    }
330}
331
332// rustdoc-stripper-ignore-next
333        /// A [builder-pattern] type to construct [`DeviceInfiniband`] objects.
334        ///
335        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
336#[must_use = "The builder must be built to be used"]
337pub struct DeviceInfinibandBuilder {
338            builder: glib::object::ObjectBuilder<'static, DeviceInfiniband>,
339        }
340
341        impl DeviceInfinibandBuilder {
342        fn new() -> Self {
343            Self { builder: glib::object::Object::builder() }
344        }
345
346                            /// Whether the device can auto-activate a connection.
347                            ///
348                            /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
349                            pub fn autoconnect(self, autoconnect: bool) -> Self {
350                            Self { builder: self.builder.property("autoconnect", autoconnect), }
351                        }
352
353    // rustdoc-stripper-ignore-next
354    /// Build the [`DeviceInfiniband`].
355    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
356    pub fn build(self) -> DeviceInfiniband {
357assert_initialized_main_thread!();
358    self.builder.build() }
359}