nm_rs/auto/
setting_team_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_12")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
8use crate::TeamLinkWatcher;
9use crate::{Setting, ffi};
10use glib::{
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// Team Port Settings
19    ///
20    /// ## Properties
21    ///
22    ///
23    /// #### `config`
24    ///  The JSON configuration for the team port. The property should contain raw
25    /// JSON configuration data suitable for teamd, because the value is passed
26    /// directly to teamd. If not specified, the default configuration is
27    /// used. See man teamd.conf for the format details.
28    ///
29    /// Readable | Writeable
30    ///
31    ///
32    /// #### `lacp-key`
33    ///  Corresponds to the teamd ports.PORTIFNAME.lacp_key.
34    ///
35    /// Readable | Writeable
36    ///
37    ///
38    /// #### `lacp-prio`
39    ///  Corresponds to the teamd ports.PORTIFNAME.lacp_prio.
40    ///
41    /// Readable | Writeable
42    ///
43    ///
44    /// #### `link-watchers`
45    ///  Link watchers configuration for the connection: each link watcher is
46    /// defined by a dictionary, whose keys depend upon the selected link
47    /// watcher. Available link watchers are 'ethtool', 'nsna_ping' and
48    /// 'arp_ping' and it is specified in the dictionary with the key 'name'.
49    /// Available keys are:   ethtool: 'delay-up', 'delay-down', 'init-wait';
50    /// nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host';
51    /// arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active',
52    /// 'validate-inactive', 'send-always'. See teamd.conf man for more details.
53    ///
54    /// Readable | Writeable
55    ///
56    ///
57    /// #### `prio`
58    ///  Corresponds to the teamd ports.PORTIFNAME.prio.
59    ///
60    /// Readable | Writeable
61    ///
62    ///
63    /// #### `queue-id`
64    ///  Corresponds to the teamd ports.PORTIFNAME.queue_id.
65    /// When set to -1 means the parameter is skipped from the json config.
66    ///
67    /// Readable | Writeable
68    ///
69    ///
70    /// #### `sticky`
71    ///  Corresponds to the teamd ports.PORTIFNAME.sticky.
72    ///
73    /// Readable | Writeable
74    /// <details><summary><h4>Setting</h4></summary>
75    ///
76    ///
77    /// #### `name`
78    ///  The setting's name, which uniquely identifies the setting within the
79    /// connection.  Each setting type has a name unique to that type, for
80    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
81    ///
82    /// Readable
83    /// </details>
84    ///
85    /// # Implements
86    ///
87    /// [`SettingExt`][trait@crate::prelude::SettingExt]
88    #[doc(alias = "NMSettingTeamPort")]
89    pub struct SettingTeamPort(Object<ffi::NMSettingTeamPort, ffi::NMSettingTeamPortClass>) @extends Setting;
90
91    match fn {
92        type_ => || ffi::nm_setting_team_port_get_type(),
93    }
94}
95
96impl SettingTeamPort {
97    /// Creates a new #NMSettingTeamPort object with default values.
98    ///
99    /// # Returns
100    ///
101    /// the new empty #NMSettingTeamPort object
102    #[doc(alias = "nm_setting_team_port_new")]
103    pub fn new() -> SettingTeamPort {
104        assert_initialized_main_thread!();
105        unsafe { Setting::from_glib_full(ffi::nm_setting_team_port_new()).unsafe_cast() }
106    }
107
108    // rustdoc-stripper-ignore-next
109    /// Creates a new builder-pattern struct instance to construct [`SettingTeamPort`] objects.
110    ///
111    /// This method returns an instance of [`SettingTeamPortBuilder`](crate::builders::SettingTeamPortBuilder) which can be used to create [`SettingTeamPort`] objects.
112    pub fn builder() -> SettingTeamPortBuilder {
113        SettingTeamPortBuilder::new()
114    }
115
116    /// Appends a new link watcher to the setting.
117    /// ## `link_watcher`
118    /// the link watcher to add
119    ///
120    /// # Returns
121    ///
122    /// [`true`] if the link watcher is added; [`false`] if an identical link
123    /// watcher was already there.
124    #[cfg(feature = "v1_12")]
125    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
126    #[doc(alias = "nm_setting_team_port_add_link_watcher")]
127    pub fn add_link_watcher(&self, link_watcher: &TeamLinkWatcher) -> bool {
128        unsafe {
129            from_glib(ffi::nm_setting_team_port_add_link_watcher(
130                self.to_glib_none().0,
131                link_watcher.to_glib_none().0,
132            ))
133        }
134    }
135
136    /// Removes all configured link watchers.
137    #[cfg(feature = "v1_12")]
138    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
139    #[doc(alias = "nm_setting_team_port_clear_link_watchers")]
140    pub fn clear_link_watchers(&self) {
141        unsafe {
142            ffi::nm_setting_team_port_clear_link_watchers(self.to_glib_none().0);
143        }
144    }
145
146    ///
147    /// # Returns
148    ///
149    /// the #NMSettingTeamPort:config property of the setting
150    #[doc(alias = "nm_setting_team_port_get_config")]
151    #[doc(alias = "get_config")]
152    pub fn config(&self) -> glib::GString {
153        unsafe { from_glib_none(ffi::nm_setting_team_port_get_config(self.to_glib_none().0)) }
154    }
155
156    ///
157    /// # Returns
158    ///
159    /// the #NMSettingTeamPort:lacp-key property of the setting
160    #[cfg(feature = "v1_12")]
161    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
162    #[doc(alias = "nm_setting_team_port_get_lacp_key")]
163    #[doc(alias = "get_lacp_key")]
164    #[doc(alias = "lacp-key")]
165    pub fn lacp_key(&self) -> i32 {
166        unsafe { ffi::nm_setting_team_port_get_lacp_key(self.to_glib_none().0) }
167    }
168
169    ///
170    /// # Returns
171    ///
172    /// the #NMSettingTeamPort:lacp-prio property of the setting
173    #[cfg(feature = "v1_12")]
174    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
175    #[doc(alias = "nm_setting_team_port_get_lacp_prio")]
176    #[doc(alias = "get_lacp_prio")]
177    #[doc(alias = "lacp-prio")]
178    pub fn lacp_prio(&self) -> i32 {
179        unsafe { ffi::nm_setting_team_port_get_lacp_prio(self.to_glib_none().0) }
180    }
181
182    /// ## `idx`
183    /// index number of the link watcher to return
184    ///
185    /// # Returns
186    ///
187    /// the link watcher at index @idx.
188    #[cfg(feature = "v1_12")]
189    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
190    #[doc(alias = "nm_setting_team_port_get_link_watcher")]
191    #[doc(alias = "get_link_watcher")]
192    pub fn link_watcher(&self, idx: u32) -> TeamLinkWatcher {
193        unsafe {
194            from_glib_none(ffi::nm_setting_team_port_get_link_watcher(
195                self.to_glib_none().0,
196                idx,
197            ))
198        }
199    }
200
201    ///
202    /// # Returns
203    ///
204    /// the number of configured link watchers
205    #[cfg(feature = "v1_12")]
206    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
207    #[doc(alias = "nm_setting_team_port_get_num_link_watchers")]
208    #[doc(alias = "get_num_link_watchers")]
209    pub fn num_link_watchers(&self) -> u32 {
210        unsafe { ffi::nm_setting_team_port_get_num_link_watchers(self.to_glib_none().0) }
211    }
212
213    ///
214    /// # Returns
215    ///
216    /// the #NMSettingTeamPort:prio property of the setting
217    #[cfg(feature = "v1_12")]
218    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
219    #[doc(alias = "nm_setting_team_port_get_prio")]
220    #[doc(alias = "get_prio")]
221    pub fn prio(&self) -> i32 {
222        unsafe { ffi::nm_setting_team_port_get_prio(self.to_glib_none().0) }
223    }
224
225    ///
226    /// # Returns
227    ///
228    /// the #NMSettingTeamPort:queue_id property of the setting
229    #[cfg(feature = "v1_12")]
230    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
231    #[doc(alias = "nm_setting_team_port_get_queue_id")]
232    #[doc(alias = "get_queue_id")]
233    #[doc(alias = "queue-id")]
234    pub fn queue_id(&self) -> i32 {
235        unsafe { ffi::nm_setting_team_port_get_queue_id(self.to_glib_none().0) }
236    }
237
238    ///
239    /// # Returns
240    ///
241    /// the #NMSettingTeamPort:sticky property of the setting
242    #[cfg(feature = "v1_12")]
243    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
244    #[doc(alias = "nm_setting_team_port_get_sticky")]
245    #[doc(alias = "get_sticky")]
246    #[doc(alias = "sticky")]
247    pub fn is_sticky(&self) -> bool {
248        unsafe { from_glib(ffi::nm_setting_team_port_get_sticky(self.to_glib_none().0)) }
249    }
250
251    /// Removes the link watcher at index #idx.
252    /// ## `idx`
253    /// index number of the link watcher to remove
254    #[cfg(feature = "v1_12")]
255    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
256    #[doc(alias = "nm_setting_team_port_remove_link_watcher")]
257    pub fn remove_link_watcher(&self, idx: u32) {
258        unsafe {
259            ffi::nm_setting_team_port_remove_link_watcher(self.to_glib_none().0, idx);
260        }
261    }
262
263    /// Removes the link watcher entry matching link_watcher.
264    /// ## `link_watcher`
265    /// the link watcher to remove
266    ///
267    /// # Returns
268    ///
269    /// [`true`] if the link watcher was found and removed, [`false`] otherwise.
270    #[cfg(feature = "v1_12")]
271    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
272    #[doc(alias = "nm_setting_team_port_remove_link_watcher_by_value")]
273    pub fn remove_link_watcher_by_value(&self, link_watcher: &TeamLinkWatcher) -> bool {
274        unsafe {
275            from_glib(ffi::nm_setting_team_port_remove_link_watcher_by_value(
276                self.to_glib_none().0,
277                link_watcher.to_glib_none().0,
278            ))
279        }
280    }
281
282    /// The JSON configuration for the team port. The property should contain raw
283    /// JSON configuration data suitable for teamd, because the value is passed
284    /// directly to teamd. If not specified, the default configuration is
285    /// used. See man teamd.conf for the format details.
286    pub fn set_config(&self, config: Option<&str>) {
287        ObjectExt::set_property(self, "config", config)
288    }
289
290    /// Corresponds to the teamd ports.PORTIFNAME.lacp_key.
291    #[cfg(feature = "v1_12")]
292    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
293    #[doc(alias = "lacp-key")]
294    pub fn set_lacp_key(&self, lacp_key: i32) {
295        ObjectExt::set_property(self, "lacp-key", lacp_key)
296    }
297
298    /// Corresponds to the teamd ports.PORTIFNAME.lacp_prio.
299    #[cfg(feature = "v1_12")]
300    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
301    #[doc(alias = "lacp-prio")]
302    pub fn set_lacp_prio(&self, lacp_prio: i32) {
303        ObjectExt::set_property(self, "lacp-prio", lacp_prio)
304    }
305
306    /// Link watchers configuration for the connection: each link watcher is
307    /// defined by a dictionary, whose keys depend upon the selected link
308    /// watcher. Available link watchers are 'ethtool', 'nsna_ping' and
309    /// 'arp_ping' and it is specified in the dictionary with the key 'name'.
310    /// Available keys are:   ethtool: 'delay-up', 'delay-down', 'init-wait';
311    /// nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host';
312    /// arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active',
313    /// 'validate-inactive', 'send-always'. See teamd.conf man for more details.
314    #[cfg(feature = "v1_12")]
315    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
316    #[doc(alias = "link-watchers")]
317    pub fn link_watchers(&self) -> Vec<TeamLinkWatcher> {
318        let vals = ObjectExt::property::<glib::ValueArray>(self, "link-watchers");
319        vals.iter()
320            .map(|value| {
321                use glib::value::FromValue;
322
323                unsafe { TeamLinkWatcher::from_value(value) }
324            })
325            .collect()
326    }
327
328    /// Link watchers configuration for the connection: each link watcher is
329    /// defined by a dictionary, whose keys depend upon the selected link
330    /// watcher. Available link watchers are 'ethtool', 'nsna_ping' and
331    /// 'arp_ping' and it is specified in the dictionary with the key 'name'.
332    /// Available keys are:   ethtool: 'delay-up', 'delay-down', 'init-wait';
333    /// nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host';
334    /// arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active',
335    /// 'validate-inactive', 'send-always'. See teamd.conf man for more details.
336    #[cfg(feature = "v1_12")]
337    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
338    #[doc(alias = "link-watchers")]
339    pub fn set_link_watchers(&self, link_watchers: &[&TeamLinkWatcher]) {
340        ObjectExt::set_property(
341            self,
342            "link-watchers",
343            link_watchers
344                .iter()
345                .map(|team_link_watcher| team_link_watcher.to_value())
346                .collect::<glib::ValueArray>(),
347        )
348    }
349
350    /// Corresponds to the teamd ports.PORTIFNAME.prio.
351    #[cfg(feature = "v1_12")]
352    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
353    pub fn set_prio(&self, prio: i32) {
354        ObjectExt::set_property(self, "prio", prio)
355    }
356
357    /// Corresponds to the teamd ports.PORTIFNAME.queue_id.
358    /// When set to -1 means the parameter is skipped from the json config.
359    #[cfg(feature = "v1_12")]
360    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
361    #[doc(alias = "queue-id")]
362    pub fn set_queue_id(&self, queue_id: i32) {
363        ObjectExt::set_property(self, "queue-id", queue_id)
364    }
365
366    /// Corresponds to the teamd ports.PORTIFNAME.sticky.
367    #[cfg(feature = "v1_12")]
368    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
369    pub fn set_sticky(&self, sticky: bool) {
370        ObjectExt::set_property(self, "sticky", sticky)
371    }
372
373    #[doc(alias = "config")]
374    pub fn connect_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
375        unsafe extern "C" fn notify_config_trampoline<F: Fn(&SettingTeamPort) + 'static>(
376            this: *mut ffi::NMSettingTeamPort,
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::config".as_ptr() as *const _,
388                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
389                    notify_config_trampoline::<F> as *const (),
390                )),
391                Box_::into_raw(f),
392            )
393        }
394    }
395
396    #[cfg(feature = "v1_12")]
397    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
398    #[doc(alias = "lacp-key")]
399    pub fn connect_lacp_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
400        unsafe extern "C" fn notify_lacp_key_trampoline<F: Fn(&SettingTeamPort) + 'static>(
401            this: *mut ffi::NMSettingTeamPort,
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::lacp-key".as_ptr() as *const _,
413                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
414                    notify_lacp_key_trampoline::<F> as *const (),
415                )),
416                Box_::into_raw(f),
417            )
418        }
419    }
420
421    #[cfg(feature = "v1_12")]
422    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
423    #[doc(alias = "lacp-prio")]
424    pub fn connect_lacp_prio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
425        unsafe extern "C" fn notify_lacp_prio_trampoline<F: Fn(&SettingTeamPort) + 'static>(
426            this: *mut ffi::NMSettingTeamPort,
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::lacp-prio".as_ptr() as *const _,
438                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
439                    notify_lacp_prio_trampoline::<F> as *const (),
440                )),
441                Box_::into_raw(f),
442            )
443        }
444    }
445
446    #[cfg(feature = "v1_12")]
447    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
448    #[doc(alias = "link-watchers")]
449    pub fn connect_link_watchers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
450        unsafe extern "C" fn notify_link_watchers_trampoline<F: Fn(&SettingTeamPort) + 'static>(
451            this: *mut ffi::NMSettingTeamPort,
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::link-watchers".as_ptr() as *const _,
463                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
464                    notify_link_watchers_trampoline::<F> as *const (),
465                )),
466                Box_::into_raw(f),
467            )
468        }
469    }
470
471    #[cfg(feature = "v1_12")]
472    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
473    #[doc(alias = "prio")]
474    pub fn connect_prio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
475        unsafe extern "C" fn notify_prio_trampoline<F: Fn(&SettingTeamPort) + 'static>(
476            this: *mut ffi::NMSettingTeamPort,
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::prio".as_ptr() as *const _,
488                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
489                    notify_prio_trampoline::<F> as *const (),
490                )),
491                Box_::into_raw(f),
492            )
493        }
494    }
495
496    #[cfg(feature = "v1_12")]
497    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
498    #[doc(alias = "queue-id")]
499    pub fn connect_queue_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
500        unsafe extern "C" fn notify_queue_id_trampoline<F: Fn(&SettingTeamPort) + 'static>(
501            this: *mut ffi::NMSettingTeamPort,
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::queue-id".as_ptr() as *const _,
513                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
514                    notify_queue_id_trampoline::<F> as *const (),
515                )),
516                Box_::into_raw(f),
517            )
518        }
519    }
520
521    #[cfg(feature = "v1_12")]
522    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
523    #[doc(alias = "sticky")]
524    pub fn connect_sticky_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
525        unsafe extern "C" fn notify_sticky_trampoline<F: Fn(&SettingTeamPort) + 'static>(
526            this: *mut ffi::NMSettingTeamPort,
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::sticky".as_ptr() as *const _,
538                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
539                    notify_sticky_trampoline::<F> as *const (),
540                )),
541                Box_::into_raw(f),
542            )
543        }
544    }
545}
546
547impl Default for SettingTeamPort {
548    fn default() -> Self {
549        Self::new()
550    }
551}
552
553// rustdoc-stripper-ignore-next
554/// A [builder-pattern] type to construct [`SettingTeamPort`] objects.
555///
556/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
557#[must_use = "The builder must be built to be used"]
558pub struct SettingTeamPortBuilder {
559    builder: glib::object::ObjectBuilder<'static, SettingTeamPort>,
560}
561
562impl SettingTeamPortBuilder {
563    fn new() -> Self {
564        Self {
565            builder: glib::object::Object::builder(),
566        }
567    }
568
569    /// The JSON configuration for the team port. The property should contain raw
570    /// JSON configuration data suitable for teamd, because the value is passed
571    /// directly to teamd. If not specified, the default configuration is
572    /// used. See man teamd.conf for the format details.
573    pub fn config(self, config: impl Into<glib::GString>) -> Self {
574        Self {
575            builder: self.builder.property("config", config.into()),
576        }
577    }
578
579    /// Corresponds to the teamd ports.PORTIFNAME.lacp_key.
580    #[cfg(feature = "v1_12")]
581    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
582    pub fn lacp_key(self, lacp_key: i32) -> Self {
583        Self {
584            builder: self.builder.property("lacp-key", lacp_key),
585        }
586    }
587
588    /// Corresponds to the teamd ports.PORTIFNAME.lacp_prio.
589    #[cfg(feature = "v1_12")]
590    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
591    pub fn lacp_prio(self, lacp_prio: i32) -> Self {
592        Self {
593            builder: self.builder.property("lacp-prio", lacp_prio),
594        }
595    }
596
597    /// Link watchers configuration for the connection: each link watcher is
598    /// defined by a dictionary, whose keys depend upon the selected link
599    /// watcher. Available link watchers are 'ethtool', 'nsna_ping' and
600    /// 'arp_ping' and it is specified in the dictionary with the key 'name'.
601    /// Available keys are:   ethtool: 'delay-up', 'delay-down', 'init-wait';
602    /// nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host';
603    /// arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active',
604    /// 'validate-inactive', 'send-always'. See teamd.conf man for more details.
605    #[cfg(feature = "v1_12")]
606    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
607    pub fn link_watchers(self, link_watchers: &[&TeamLinkWatcher]) -> Self {
608        Self {
609            builder: self.builder.property(
610                "link-watchers",
611                link_watchers
612                    .iter()
613                    .map(|team_link_watcher| team_link_watcher.to_value())
614                    .collect::<glib::ValueArray>(),
615            ),
616        }
617    }
618
619    /// Corresponds to the teamd ports.PORTIFNAME.prio.
620    #[cfg(feature = "v1_12")]
621    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
622    pub fn prio(self, prio: i32) -> Self {
623        Self {
624            builder: self.builder.property("prio", prio),
625        }
626    }
627
628    /// Corresponds to the teamd ports.PORTIFNAME.queue_id.
629    /// When set to -1 means the parameter is skipped from the json config.
630    #[cfg(feature = "v1_12")]
631    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
632    pub fn queue_id(self, queue_id: i32) -> Self {
633        Self {
634            builder: self.builder.property("queue-id", queue_id),
635        }
636    }
637
638    /// Corresponds to the teamd ports.PORTIFNAME.sticky.
639    #[cfg(feature = "v1_12")]
640    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
641    pub fn sticky(self, sticky: bool) -> Self {
642        Self {
643            builder: self.builder.property("sticky", sticky),
644        }
645    }
646
647    // rustdoc-stripper-ignore-next
648    /// Build the [`SettingTeamPort`].
649    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
650    pub fn build(self) -> SettingTeamPort {
651        assert_initialized_main_thread!();
652        self.builder.build()
653    }
654}