nm_rs/auto/
setting6_lowpan.rs1use crate::{ffi,Setting};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 #[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 #[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 pub fn builder() -> Setting6LowpanBuilder {
64 Setting6LowpanBuilder::new()
65 }
66
67
68 #[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 #[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#[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 #[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 #[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}