nm_rs/auto/
setting6_lowpan.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,Setting};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11    /// 6LoWPAN Settings
12    ///
13    /// ## Properties
14    ///
15    ///
16    /// #### `parent`
17    ///  If given, specifies the parent interface name or parent connection UUID
18    /// from which this 6LowPAN interface should be created.
19    ///
20    /// Readable | Writeable
21    /// <details><summary><h4>Setting</h4></summary>
22    ///
23    ///
24    /// #### `name`
25    ///  The setting's name, which uniquely identifies the setting within the
26    /// connection.  Each setting type has a name unique to that type, for
27    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
28    ///
29    /// Readable
30    /// </details>
31    ///
32    /// # Implements
33    ///
34    /// [`SettingExt`][trait@crate::prelude::SettingExt]
35    #[doc(alias = "NMSetting6Lowpan")]
36    pub struct Setting6Lowpan(Object<ffi::NMSetting6Lowpan, ffi::NMSetting6LowpanClass>) @extends Setting;
37
38    match fn {
39        type_ => || ffi::nm_setting_6lowpan_get_type(),
40    }
41}
42
43impl Setting6Lowpan {
44    /// Creates a new #NMSetting6Lowpan object with default values.
45    ///
46    /// # Returns
47    ///
48    /// the new empty #NMSetting6Lowpan object
49    #[cfg(feature = "v1_42")]
50    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
51    #[doc(alias = "nm_setting_6lowpan_new")]
52    pub fn new() -> Setting6Lowpan {
53        assert_initialized_main_thread!();
54        unsafe {
55            Setting::from_glib_full(ffi::nm_setting_6lowpan_new()).unsafe_cast()
56        }
57    }
58
59            // rustdoc-stripper-ignore-next
60            /// Creates a new builder-pattern struct instance to construct [`Setting6Lowpan`] objects.
61            ///
62            /// This method returns an instance of [`Setting6LowpanBuilder`](crate::builders::Setting6LowpanBuilder) which can be used to create [`Setting6Lowpan`] objects.
63            pub fn builder() -> Setting6LowpanBuilder {
64                Setting6LowpanBuilder::new()
65            }
66        
67
68    ///
69    /// # Returns
70    ///
71    /// the #NMSetting6Lowpan:parent property of the setting
72    #[cfg(feature = "v1_42")]
73    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
74    #[doc(alias = "nm_setting_6lowpan_get_parent")]
75    #[doc(alias = "get_parent")]
76    pub fn parent(&self) -> glib::GString {
77        unsafe {
78            from_glib_none(ffi::nm_setting_6lowpan_get_parent(self.to_glib_none().0))
79        }
80    }
81
82    #[cfg(not(feature = "v1_42"))]
83    #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_42"))))]
84    pub fn parent(&self) -> Option<glib::GString> {
85        ObjectExt::property(self, "parent")
86    }
87
88    /// If given, specifies the parent interface name or parent connection UUID
89    /// from which this 6LowPAN interface should be created.
90    #[cfg(feature = "v1_14")]
91    #[cfg_attr(docsrs, doc(cfg(feature = "v1_14")))]
92    pub fn set_parent(&self, parent: Option<&str>) {
93        ObjectExt::set_property(self,"parent", parent)
94    }
95
96    #[cfg(feature = "v1_14")]
97    #[cfg_attr(docsrs, doc(cfg(feature = "v1_14")))]
98    #[doc(alias = "parent")]
99    pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
100        unsafe extern "C" fn notify_parent_trampoline<F: Fn(&Setting6Lowpan) + 'static>(this: *mut ffi::NMSetting6Lowpan, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
101            let f: &F = &*(f as *const F);
102            f(&from_glib_borrow(this))
103        }
104        unsafe {
105            let f: Box_<F> = Box_::new(f);
106            connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
107                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
108        }
109    }
110}
111
112#[cfg(feature = "v1_42")]
113#[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
114impl Default for Setting6Lowpan {
115                     fn default() -> Self {
116                         Self::new()
117                     }
118                 }
119
120// rustdoc-stripper-ignore-next
121        /// A [builder-pattern] type to construct [`Setting6Lowpan`] objects.
122        ///
123        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
124#[must_use = "The builder must be built to be used"]
125pub struct Setting6LowpanBuilder {
126            builder: glib::object::ObjectBuilder<'static, Setting6Lowpan>,
127        }
128
129        impl Setting6LowpanBuilder {
130        fn new() -> Self {
131            Self { builder: glib::object::Object::builder() }
132        }
133
134                            /// If given, specifies the parent interface name or parent connection UUID
135                            /// from which this 6LowPAN interface should be created.
136                            #[cfg(feature = "v1_14")]
137    #[cfg_attr(docsrs, doc(cfg(feature = "v1_14")))]
138    pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
139                            Self { builder: self.builder.property("parent", parent.into()), }
140                        }
141
142    // rustdoc-stripper-ignore-next
143    /// Build the [`Setting6Lowpan`].
144    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
145    pub fn build(self) -> Setting6Lowpan {
146assert_initialized_main_thread!();
147    self.builder.build() }
148}