nm_rs/auto/
setting_ovs_port.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
6#[cfg(feature = "v1_42")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
8use crate::Range;
9use crate::{Setting, ffi};
10use glib::prelude::*;
11#[cfg(feature = "v1_10")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
13use glib::{
14    signal::{SignalHandlerId, connect_raw},
15    translate::*,
16};
17#[cfg(feature = "v1_10")]
18#[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
19use std::boxed::Box as Box_;
20
21glib::wrapper! {
22    /// OvsPort Link Settings
23    ///
24    /// ## Properties
25    ///
26    ///
27    /// #### `bond-downdelay`
28    ///  The time port must be inactive in order to be considered down.
29    ///
30    /// Readable | Writeable
31    ///
32    ///
33    /// #### `bond-mode`
34    ///  Bonding mode. One of "active-backup", "balance-slb", or "balance-tcp".
35    ///
36    /// Readable | Writeable
37    ///
38    ///
39    /// #### `bond-updelay`
40    ///  The time port must be active before it starts forwarding traffic.
41    ///
42    /// Readable | Writeable
43    ///
44    ///
45    /// #### `lacp`
46    ///  LACP mode. One of "active", "off", or "passive".
47    ///
48    /// Readable | Writeable
49    ///
50    ///
51    /// #### `tag`
52    ///  The VLAN tag in the range 0-4095.
53    ///
54    /// Readable | Writeable
55    ///
56    ///
57    /// #### `trunks`
58    ///  A list of VLAN ranges that this port trunks.
59    ///
60    /// The property is valid only for ports with mode "trunk",
61    /// "native-tagged", or "native-untagged port".
62    /// If it is empty, the port trunks all VLANs.
63    ///
64    /// Readable | Writeable
65    ///
66    ///
67    /// #### `vlan-mode`
68    ///  The VLAN mode. One of "access", "native-tagged", "native-untagged",
69    /// "trunk", "dot1q-tunnel" or unset.
70    ///
71    /// Readable | Writeable
72    /// <details><summary><h4>Setting</h4></summary>
73    ///
74    ///
75    /// #### `name`
76    ///  The setting's name, which uniquely identifies the setting within the
77    /// connection.  Each setting type has a name unique to that type, for
78    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
79    ///
80    /// Readable
81    /// </details>
82    ///
83    /// # Implements
84    ///
85    /// [`SettingExt`][trait@crate::prelude::SettingExt]
86    #[doc(alias = "NMSettingOvsPort")]
87    pub struct SettingOvsPort(Object<ffi::NMSettingOvsPort, ffi::NMSettingOvsPortClass>) @extends Setting;
88
89    match fn {
90        type_ => || ffi::nm_setting_ovs_port_get_type(),
91    }
92}
93
94impl SettingOvsPort {
95    /// Creates a new #NMSettingOvsPort object with default values.
96    ///
97    /// # Returns
98    ///
99    /// the new empty #NMSettingOvsPort object
100    #[cfg(feature = "v1_10")]
101    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
102    #[doc(alias = "nm_setting_ovs_port_new")]
103    pub fn new() -> SettingOvsPort {
104        assert_initialized_main_thread!();
105        unsafe { Setting::from_glib_full(ffi::nm_setting_ovs_port_new()).unsafe_cast() }
106    }
107
108    // rustdoc-stripper-ignore-next
109    /// Creates a new builder-pattern struct instance to construct [`SettingOvsPort`] objects.
110    ///
111    /// This method returns an instance of [`SettingOvsPortBuilder`](crate::builders::SettingOvsPortBuilder) which can be used to create [`SettingOvsPort`] objects.
112    pub fn builder() -> SettingOvsPortBuilder {
113        SettingOvsPortBuilder::new()
114    }
115
116    /// Appends a new trunk range to the setting.
117    /// This takes a reference to @trunk.
118    /// ## `trunk`
119    /// the trunk to add
120    #[cfg(feature = "v1_42")]
121    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
122    #[doc(alias = "nm_setting_ovs_port_add_trunk")]
123    pub fn add_trunk(&self, trunk: &Range) {
124        unsafe {
125            ffi::nm_setting_ovs_port_add_trunk(self.to_glib_none().0, trunk.to_glib_none().0);
126        }
127    }
128
129    /// Removes all configured trunk ranges.
130    #[cfg(feature = "v1_42")]
131    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
132    #[doc(alias = "nm_setting_ovs_port_clear_trunks")]
133    pub fn clear_trunks(&self) {
134        unsafe {
135            ffi::nm_setting_ovs_port_clear_trunks(self.to_glib_none().0);
136        }
137    }
138
139    ///
140    /// # Returns
141    ///
142    /// the #NMSettingOvsPort:bond-downdelay property of the setting
143    #[cfg(feature = "v1_10")]
144    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
145    #[doc(alias = "nm_setting_ovs_port_get_bond_downdelay")]
146    #[doc(alias = "get_bond_downdelay")]
147    #[doc(alias = "bond-downdelay")]
148    pub fn bond_downdelay(&self) -> u32 {
149        unsafe { ffi::nm_setting_ovs_port_get_bond_downdelay(self.to_glib_none().0) }
150    }
151
152    ///
153    /// # Returns
154    ///
155    /// the #NMSettingOvsPort:bond-mode property of the setting
156    #[cfg(feature = "v1_10")]
157    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
158    #[doc(alias = "nm_setting_ovs_port_get_bond_mode")]
159    #[doc(alias = "get_bond_mode")]
160    #[doc(alias = "bond-mode")]
161    pub fn bond_mode(&self) -> glib::GString {
162        unsafe {
163            from_glib_none(ffi::nm_setting_ovs_port_get_bond_mode(
164                self.to_glib_none().0,
165            ))
166        }
167    }
168
169    ///
170    /// # Returns
171    ///
172    /// the #NMSettingOvsPort:bond-updelay property of the setting
173    #[cfg(feature = "v1_10")]
174    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
175    #[doc(alias = "nm_setting_ovs_port_get_bond_updelay")]
176    #[doc(alias = "get_bond_updelay")]
177    #[doc(alias = "bond-updelay")]
178    pub fn bond_updelay(&self) -> u32 {
179        unsafe { ffi::nm_setting_ovs_port_get_bond_updelay(self.to_glib_none().0) }
180    }
181
182    ///
183    /// # Returns
184    ///
185    /// the #NMSettingOvsPort:lacp property of the setting
186    #[cfg(feature = "v1_10")]
187    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
188    #[doc(alias = "nm_setting_ovs_port_get_lacp")]
189    #[doc(alias = "get_lacp")]
190    pub fn lacp(&self) -> glib::GString {
191        unsafe { from_glib_none(ffi::nm_setting_ovs_port_get_lacp(self.to_glib_none().0)) }
192    }
193
194    ///
195    /// # Returns
196    ///
197    /// the number of trunk ranges
198    #[cfg(feature = "v1_42")]
199    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
200    #[doc(alias = "nm_setting_ovs_port_get_num_trunks")]
201    #[doc(alias = "get_num_trunks")]
202    pub fn num_trunks(&self) -> u32 {
203        unsafe { ffi::nm_setting_ovs_port_get_num_trunks(self.to_glib_none().0) }
204    }
205
206    ///
207    /// # Returns
208    ///
209    /// the #NMSettingOvsPort:tag property of the setting
210    #[cfg(feature = "v1_10")]
211    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
212    #[doc(alias = "nm_setting_ovs_port_get_tag")]
213    #[doc(alias = "get_tag")]
214    pub fn tag(&self) -> u32 {
215        unsafe { ffi::nm_setting_ovs_port_get_tag(self.to_glib_none().0) }
216    }
217
218    /// ## `idx`
219    /// index number of the trunk range to return
220    ///
221    /// # Returns
222    ///
223    /// the trunk range at index @idx
224    #[cfg(feature = "v1_42")]
225    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
226    #[doc(alias = "nm_setting_ovs_port_get_trunk")]
227    #[doc(alias = "get_trunk")]
228    pub fn trunk(&self, idx: u32) -> Range {
229        unsafe {
230            from_glib_none(ffi::nm_setting_ovs_port_get_trunk(
231                self.to_glib_none().0,
232                idx,
233            ))
234        }
235    }
236
237    ///
238    /// # Returns
239    ///
240    /// the #NMSettingOvsPort:vlan-mode property of the setting
241    #[cfg(feature = "v1_10")]
242    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
243    #[doc(alias = "nm_setting_ovs_port_get_vlan_mode")]
244    #[doc(alias = "get_vlan_mode")]
245    #[doc(alias = "vlan-mode")]
246    pub fn vlan_mode(&self) -> glib::GString {
247        unsafe {
248            from_glib_none(ffi::nm_setting_ovs_port_get_vlan_mode(
249                self.to_glib_none().0,
250            ))
251        }
252    }
253
254    /// Removes the trunk range at index @idx.
255    /// ## `idx`
256    /// index number of the trunk range.
257    #[cfg(feature = "v1_42")]
258    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
259    #[doc(alias = "nm_setting_ovs_port_remove_trunk")]
260    pub fn remove_trunk(&self, idx: u32) {
261        unsafe {
262            ffi::nm_setting_ovs_port_remove_trunk(self.to_glib_none().0, idx);
263        }
264    }
265
266    /// Remove the trunk range with range @start to @end.
267    /// ## `start`
268    /// the trunk range start index
269    /// ## `end`
270    /// the trunk range end index
271    ///
272    /// # Returns
273    ///
274    /// [`true`] if the trunk range was found and removed; [`false`] otherwise
275    #[cfg(feature = "v1_42")]
276    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
277    #[doc(alias = "nm_setting_ovs_port_remove_trunk_by_value")]
278    pub fn remove_trunk_by_value(&self, start: u32, end: u32) -> bool {
279        unsafe {
280            from_glib(ffi::nm_setting_ovs_port_remove_trunk_by_value(
281                self.to_glib_none().0,
282                start,
283                end,
284            ))
285        }
286    }
287
288    /// The time port must be inactive in order to be considered down.
289    #[cfg(feature = "v1_10")]
290    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
291    #[doc(alias = "bond-downdelay")]
292    pub fn set_bond_downdelay(&self, bond_downdelay: u32) {
293        ObjectExt::set_property(self, "bond-downdelay", bond_downdelay)
294    }
295
296    /// Bonding mode. One of "active-backup", "balance-slb", or "balance-tcp".
297    #[cfg(feature = "v1_10")]
298    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
299    #[doc(alias = "bond-mode")]
300    pub fn set_bond_mode(&self, bond_mode: Option<&str>) {
301        ObjectExt::set_property(self, "bond-mode", bond_mode)
302    }
303
304    /// The time port must be active before it starts forwarding traffic.
305    #[cfg(feature = "v1_10")]
306    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
307    #[doc(alias = "bond-updelay")]
308    pub fn set_bond_updelay(&self, bond_updelay: u32) {
309        ObjectExt::set_property(self, "bond-updelay", bond_updelay)
310    }
311
312    /// LACP mode. One of "active", "off", or "passive".
313    #[cfg(feature = "v1_10")]
314    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
315    pub fn set_lacp(&self, lacp: Option<&str>) {
316        ObjectExt::set_property(self, "lacp", lacp)
317    }
318
319    /// The VLAN tag in the range 0-4095.
320    #[cfg(feature = "v1_10")]
321    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
322    pub fn set_tag(&self, tag: u32) {
323        ObjectExt::set_property(self, "tag", tag)
324    }
325
326    /// A list of VLAN ranges that this port trunks.
327    ///
328    /// The property is valid only for ports with mode "trunk",
329    /// "native-tagged", or "native-untagged port".
330    /// If it is empty, the port trunks all VLANs.
331    #[cfg(feature = "v1_42")]
332    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
333    pub fn trunks(&self) -> Vec<Range> {
334        let vals = ObjectExt::property::<glib::ValueArray>(self, "trunks");
335        vals.iter()
336            .map(|value| {
337                use glib::value::FromValue;
338
339                unsafe { Range::from_value(value) }
340            })
341            .collect()
342    }
343
344    /// A list of VLAN ranges that this port trunks.
345    ///
346    /// The property is valid only for ports with mode "trunk",
347    /// "native-tagged", or "native-untagged port".
348    /// If it is empty, the port trunks all VLANs.
349    #[cfg(feature = "v1_42")]
350    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
351    pub fn set_trunks(&self, trunks: &[&Range]) {
352        ObjectExt::set_property(
353            self,
354            "trunks",
355            trunks
356                .iter()
357                .map(|trunk| trunk.to_value())
358                .collect::<glib::ValueArray>(),
359        )
360    }
361
362    /// The VLAN mode. One of "access", "native-tagged", "native-untagged",
363    /// "trunk", "dot1q-tunnel" or unset.
364    #[cfg(feature = "v1_10")]
365    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
366    #[doc(alias = "vlan-mode")]
367    pub fn set_vlan_mode(&self, vlan_mode: Option<&str>) {
368        ObjectExt::set_property(self, "vlan-mode", vlan_mode)
369    }
370
371    #[cfg(feature = "v1_10")]
372    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
373    #[doc(alias = "bond-downdelay")]
374    pub fn connect_bond_downdelay_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
375        unsafe extern "C" fn notify_bond_downdelay_trampoline<F: Fn(&SettingOvsPort) + 'static>(
376            this: *mut ffi::NMSettingOvsPort,
377            _param_spec: glib::ffi::gpointer,
378            f: glib::ffi::gpointer,
379        ) {
380            let f: &F = &*(f as *const F);
381            f(&from_glib_borrow(this))
382        }
383        unsafe {
384            let f: Box_<F> = Box_::new(f);
385            connect_raw(
386                self.as_ptr() as *mut _,
387                c"notify::bond-downdelay".as_ptr() as *const _,
388                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
389                    notify_bond_downdelay_trampoline::<F> as *const (),
390                )),
391                Box_::into_raw(f),
392            )
393        }
394    }
395
396    #[cfg(feature = "v1_10")]
397    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
398    #[doc(alias = "bond-mode")]
399    pub fn connect_bond_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
400        unsafe extern "C" fn notify_bond_mode_trampoline<F: Fn(&SettingOvsPort) + 'static>(
401            this: *mut ffi::NMSettingOvsPort,
402            _param_spec: glib::ffi::gpointer,
403            f: glib::ffi::gpointer,
404        ) {
405            let f: &F = &*(f as *const F);
406            f(&from_glib_borrow(this))
407        }
408        unsafe {
409            let f: Box_<F> = Box_::new(f);
410            connect_raw(
411                self.as_ptr() as *mut _,
412                c"notify::bond-mode".as_ptr() as *const _,
413                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
414                    notify_bond_mode_trampoline::<F> as *const (),
415                )),
416                Box_::into_raw(f),
417            )
418        }
419    }
420
421    #[cfg(feature = "v1_10")]
422    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
423    #[doc(alias = "bond-updelay")]
424    pub fn connect_bond_updelay_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
425        unsafe extern "C" fn notify_bond_updelay_trampoline<F: Fn(&SettingOvsPort) + 'static>(
426            this: *mut ffi::NMSettingOvsPort,
427            _param_spec: glib::ffi::gpointer,
428            f: glib::ffi::gpointer,
429        ) {
430            let f: &F = &*(f as *const F);
431            f(&from_glib_borrow(this))
432        }
433        unsafe {
434            let f: Box_<F> = Box_::new(f);
435            connect_raw(
436                self.as_ptr() as *mut _,
437                c"notify::bond-updelay".as_ptr() as *const _,
438                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
439                    notify_bond_updelay_trampoline::<F> as *const (),
440                )),
441                Box_::into_raw(f),
442            )
443        }
444    }
445
446    #[cfg(feature = "v1_10")]
447    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
448    #[doc(alias = "lacp")]
449    pub fn connect_lacp_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
450        unsafe extern "C" fn notify_lacp_trampoline<F: Fn(&SettingOvsPort) + 'static>(
451            this: *mut ffi::NMSettingOvsPort,
452            _param_spec: glib::ffi::gpointer,
453            f: glib::ffi::gpointer,
454        ) {
455            let f: &F = &*(f as *const F);
456            f(&from_glib_borrow(this))
457        }
458        unsafe {
459            let f: Box_<F> = Box_::new(f);
460            connect_raw(
461                self.as_ptr() as *mut _,
462                c"notify::lacp".as_ptr() as *const _,
463                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
464                    notify_lacp_trampoline::<F> as *const (),
465                )),
466                Box_::into_raw(f),
467            )
468        }
469    }
470
471    #[cfg(feature = "v1_10")]
472    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
473    #[doc(alias = "tag")]
474    pub fn connect_tag_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
475        unsafe extern "C" fn notify_tag_trampoline<F: Fn(&SettingOvsPort) + 'static>(
476            this: *mut ffi::NMSettingOvsPort,
477            _param_spec: glib::ffi::gpointer,
478            f: glib::ffi::gpointer,
479        ) {
480            let f: &F = &*(f as *const F);
481            f(&from_glib_borrow(this))
482        }
483        unsafe {
484            let f: Box_<F> = Box_::new(f);
485            connect_raw(
486                self.as_ptr() as *mut _,
487                c"notify::tag".as_ptr() as *const _,
488                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
489                    notify_tag_trampoline::<F> as *const (),
490                )),
491                Box_::into_raw(f),
492            )
493        }
494    }
495
496    #[cfg(feature = "v1_42")]
497    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
498    #[doc(alias = "trunks")]
499    pub fn connect_trunks_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
500        unsafe extern "C" fn notify_trunks_trampoline<F: Fn(&SettingOvsPort) + 'static>(
501            this: *mut ffi::NMSettingOvsPort,
502            _param_spec: glib::ffi::gpointer,
503            f: glib::ffi::gpointer,
504        ) {
505            let f: &F = &*(f as *const F);
506            f(&from_glib_borrow(this))
507        }
508        unsafe {
509            let f: Box_<F> = Box_::new(f);
510            connect_raw(
511                self.as_ptr() as *mut _,
512                c"notify::trunks".as_ptr() as *const _,
513                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
514                    notify_trunks_trampoline::<F> as *const (),
515                )),
516                Box_::into_raw(f),
517            )
518        }
519    }
520
521    #[cfg(feature = "v1_10")]
522    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
523    #[doc(alias = "vlan-mode")]
524    pub fn connect_vlan_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
525        unsafe extern "C" fn notify_vlan_mode_trampoline<F: Fn(&SettingOvsPort) + 'static>(
526            this: *mut ffi::NMSettingOvsPort,
527            _param_spec: glib::ffi::gpointer,
528            f: glib::ffi::gpointer,
529        ) {
530            let f: &F = &*(f as *const F);
531            f(&from_glib_borrow(this))
532        }
533        unsafe {
534            let f: Box_<F> = Box_::new(f);
535            connect_raw(
536                self.as_ptr() as *mut _,
537                c"notify::vlan-mode".as_ptr() as *const _,
538                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
539                    notify_vlan_mode_trampoline::<F> as *const (),
540                )),
541                Box_::into_raw(f),
542            )
543        }
544    }
545}
546
547#[cfg(feature = "v1_10")]
548#[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
549impl Default for SettingOvsPort {
550    fn default() -> Self {
551        Self::new()
552    }
553}
554
555// rustdoc-stripper-ignore-next
556/// A [builder-pattern] type to construct [`SettingOvsPort`] objects.
557///
558/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
559#[must_use = "The builder must be built to be used"]
560pub struct SettingOvsPortBuilder {
561    builder: glib::object::ObjectBuilder<'static, SettingOvsPort>,
562}
563
564impl SettingOvsPortBuilder {
565    fn new() -> Self {
566        Self {
567            builder: glib::object::Object::builder(),
568        }
569    }
570
571    /// The time port must be inactive in order to be considered down.
572    #[cfg(feature = "v1_10")]
573    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
574    pub fn bond_downdelay(self, bond_downdelay: u32) -> Self {
575        Self {
576            builder: self.builder.property("bond-downdelay", bond_downdelay),
577        }
578    }
579
580    /// Bonding mode. One of "active-backup", "balance-slb", or "balance-tcp".
581    #[cfg(feature = "v1_10")]
582    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
583    pub fn bond_mode(self, bond_mode: impl Into<glib::GString>) -> Self {
584        Self {
585            builder: self.builder.property("bond-mode", bond_mode.into()),
586        }
587    }
588
589    /// The time port must be active before it starts forwarding traffic.
590    #[cfg(feature = "v1_10")]
591    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
592    pub fn bond_updelay(self, bond_updelay: u32) -> Self {
593        Self {
594            builder: self.builder.property("bond-updelay", bond_updelay),
595        }
596    }
597
598    /// LACP mode. One of "active", "off", or "passive".
599    #[cfg(feature = "v1_10")]
600    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
601    pub fn lacp(self, lacp: impl Into<glib::GString>) -> Self {
602        Self {
603            builder: self.builder.property("lacp", lacp.into()),
604        }
605    }
606
607    /// The VLAN tag in the range 0-4095.
608    #[cfg(feature = "v1_10")]
609    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
610    pub fn tag(self, tag: u32) -> Self {
611        Self {
612            builder: self.builder.property("tag", tag),
613        }
614    }
615
616    /// A list of VLAN ranges that this port trunks.
617    ///
618    /// The property is valid only for ports with mode "trunk",
619    /// "native-tagged", or "native-untagged port".
620    /// If it is empty, the port trunks all VLANs.
621    #[cfg(feature = "v1_42")]
622    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
623    pub fn trunks(self, trunks: &[&Range]) -> Self {
624        Self {
625            builder: self.builder.property(
626                "trunks",
627                trunks
628                    .iter()
629                    .map(|trunk| trunk.to_value())
630                    .collect::<glib::ValueArray>(),
631            ),
632        }
633    }
634
635    /// The VLAN mode. One of "access", "native-tagged", "native-untagged",
636    /// "trunk", "dot1q-tunnel" or unset.
637    #[cfg(feature = "v1_10")]
638    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
639    pub fn vlan_mode(self, vlan_mode: impl Into<glib::GString>) -> Self {
640        Self {
641            builder: self.builder.property("vlan-mode", vlan_mode.into()),
642        }
643    }
644
645    // rustdoc-stripper-ignore-next
646    /// Build the [`SettingOvsPort`].
647    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
648    pub fn build(self) -> SettingOvsPort {
649        assert_initialized_main_thread!();
650        self.builder.build()
651    }
652}