nm_rs/auto/
setting_ipvlan.rs1use crate::{ffi,Setting};
7#[cfg(feature = "v1_52")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
9use crate::{SettingIpvlanMode};
10use glib::{prelude::*};
11#[cfg(feature = "v1_52")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
13use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
14#[cfg(feature = "v1_52")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
16use std::{boxed::Box as Box_};
17
18glib::wrapper! {
19 #[doc(alias = "NMSettingIpvlan")]
65 pub struct SettingIpvlan(Object<ffi::NMSettingIpvlan, ffi::NMSettingIpvlanClass>) @extends Setting;
66
67 match fn {
68 type_ => || ffi::nm_setting_ipvlan_get_type(),
69 }
70}
71
72impl SettingIpvlan {
73 #[cfg(feature = "v1_52")]
79 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
80 #[doc(alias = "nm_setting_ipvlan_new")]
81 pub fn new() -> SettingIpvlan {
82 assert_initialized_main_thread!();
83 unsafe {
84 Setting::from_glib_full(ffi::nm_setting_ipvlan_new()).unsafe_cast()
85 }
86 }
87
88 pub fn builder() -> SettingIpvlanBuilder {
93 SettingIpvlanBuilder::new()
94 }
95
96
97 #[cfg(feature = "v1_52")]
102 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
103 #[doc(alias = "nm_setting_ipvlan_get_mode")]
104 #[doc(alias = "get_mode")]
105 pub fn mode(&self) -> SettingIpvlanMode {
106 unsafe {
107 from_glib(ffi::nm_setting_ipvlan_get_mode(self.to_glib_none().0))
108 }
109 }
110
111 #[cfg(feature = "v1_52")]
116 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
117 #[doc(alias = "nm_setting_ipvlan_get_parent")]
118 #[doc(alias = "get_parent")]
119 pub fn parent(&self) -> glib::GString {
120 unsafe {
121 from_glib_none(ffi::nm_setting_ipvlan_get_parent(self.to_glib_none().0))
122 }
123 }
124
125 #[cfg(feature = "v1_52")]
130 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
131 #[doc(alias = "nm_setting_ipvlan_get_private")]
132 #[doc(alias = "get_private")]
133 #[doc(alias = "private")]
134 pub fn is_private(&self) -> bool {
135 unsafe {
136 from_glib(ffi::nm_setting_ipvlan_get_private(self.to_glib_none().0))
137 }
138 }
139
140 #[cfg(feature = "v1_52")]
145 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
146 #[doc(alias = "nm_setting_ipvlan_get_vepa")]
147 #[doc(alias = "get_vepa")]
148 #[doc(alias = "vepa")]
149 pub fn is_vepa(&self) -> bool {
150 unsafe {
151 from_glib(ffi::nm_setting_ipvlan_get_vepa(self.to_glib_none().0))
152 }
153 }
154
155 #[cfg(feature = "v1_52")]
158 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
159 pub fn set_mode(&self, mode: u32) {
160 ObjectExt::set_property(self,"mode", mode)
161 }
162
163 #[cfg(feature = "v1_52")]
168 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
169 pub fn set_parent(&self, parent: Option<&str>) {
170 ObjectExt::set_property(self,"parent", parent)
171 }
172
173 #[cfg(feature = "v1_52")]
175 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
176 pub fn set_private(&self, private: bool) {
177 ObjectExt::set_property(self,"private", private)
178 }
179
180 #[cfg(feature = "v1_52")]
182 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
183 pub fn set_vepa(&self, vepa: bool) {
184 ObjectExt::set_property(self,"vepa", vepa)
185 }
186
187 #[cfg(feature = "v1_52")]
188 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
189 #[doc(alias = "mode")]
190 pub fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
191 unsafe extern "C" fn notify_mode_trampoline<F: Fn(&SettingIpvlan) + 'static>(this: *mut ffi::NMSettingIpvlan, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
192 let f: &F = &*(f as *const F);
193 f(&from_glib_borrow(this))
194 }
195 unsafe {
196 let f: Box_<F> = Box_::new(f);
197 connect_raw(self.as_ptr() as *mut _, c"notify::mode".as_ptr() as *const _,
198 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mode_trampoline::<F> as *const ())), Box_::into_raw(f))
199 }
200 }
201
202 #[cfg(feature = "v1_52")]
203 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
204 #[doc(alias = "parent")]
205 pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
206 unsafe extern "C" fn notify_parent_trampoline<F: Fn(&SettingIpvlan) + 'static>(this: *mut ffi::NMSettingIpvlan, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
207 let f: &F = &*(f as *const F);
208 f(&from_glib_borrow(this))
209 }
210 unsafe {
211 let f: Box_<F> = Box_::new(f);
212 connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
213 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
214 }
215 }
216
217 #[cfg(feature = "v1_52")]
218 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
219 #[doc(alias = "private")]
220 pub fn connect_private_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
221 unsafe extern "C" fn notify_private_trampoline<F: Fn(&SettingIpvlan) + 'static>(this: *mut ffi::NMSettingIpvlan, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
222 let f: &F = &*(f as *const F);
223 f(&from_glib_borrow(this))
224 }
225 unsafe {
226 let f: Box_<F> = Box_::new(f);
227 connect_raw(self.as_ptr() as *mut _, c"notify::private".as_ptr() as *const _,
228 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_private_trampoline::<F> as *const ())), Box_::into_raw(f))
229 }
230 }
231
232 #[cfg(feature = "v1_52")]
233 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
234 #[doc(alias = "vepa")]
235 pub fn connect_vepa_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
236 unsafe extern "C" fn notify_vepa_trampoline<F: Fn(&SettingIpvlan) + 'static>(this: *mut ffi::NMSettingIpvlan, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
237 let f: &F = &*(f as *const F);
238 f(&from_glib_borrow(this))
239 }
240 unsafe {
241 let f: Box_<F> = Box_::new(f);
242 connect_raw(self.as_ptr() as *mut _, c"notify::vepa".as_ptr() as *const _,
243 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vepa_trampoline::<F> as *const ())), Box_::into_raw(f))
244 }
245 }
246}
247
248#[cfg(feature = "v1_52")]
249#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
250impl Default for SettingIpvlan {
251 fn default() -> Self {
252 Self::new()
253 }
254 }
255
256#[must_use = "The builder must be built to be used"]
261pub struct SettingIpvlanBuilder {
262 builder: glib::object::ObjectBuilder<'static, SettingIpvlan>,
263 }
264
265 impl SettingIpvlanBuilder {
266 fn new() -> Self {
267 Self { builder: glib::object::Object::builder() }
268 }
269
270 #[cfg(feature = "v1_52")]
273 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
274 pub fn mode(self, mode: u32) -> Self {
275 Self { builder: self.builder.property("mode", mode), }
276 }
277
278 #[cfg(feature = "v1_52")]
283 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
284 pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
285 Self { builder: self.builder.property("parent", parent.into()), }
286 }
287
288 #[cfg(feature = "v1_52")]
290 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
291 pub fn private(self, private: bool) -> Self {
292 Self { builder: self.builder.property("private", private), }
293 }
294
295 #[cfg(feature = "v1_52")]
297 #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
298 pub fn vepa(self, vepa: bool) -> Self {
299 Self { builder: self.builder.property("vepa", vepa), }
300 }
301
302 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
305 pub fn build(self) -> SettingIpvlan {
306assert_initialized_main_thread!();
307 self.builder.build() }
308}