nm_rs/auto/
setting_bond_port.rs1use crate::{ffi,Setting};
7use glib::{prelude::*};
8#[cfg(feature = "v1_34")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
10use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
11#[cfg(feature = "v1_34")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
13use std::{boxed::Box as Box_};
14
15glib::wrapper! {
16 #[doc(alias = "NMSettingBondPort")]
50 pub struct SettingBondPort(Object<ffi::NMSettingBondPort, ffi::NMSettingBondPortClass>) @extends Setting;
51
52 match fn {
53 type_ => || ffi::nm_setting_bond_port_get_type(),
54 }
55}
56
57impl SettingBondPort {
58 #[cfg(feature = "v1_34")]
64 #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
65 #[doc(alias = "nm_setting_bond_port_new")]
66 pub fn new() -> SettingBondPort {
67 assert_initialized_main_thread!();
68 unsafe {
69 Setting::from_glib_full(ffi::nm_setting_bond_port_new()).unsafe_cast()
70 }
71 }
72
73 pub fn builder() -> SettingBondPortBuilder {
78 SettingBondPortBuilder::new()
79 }
80
81
82 #[cfg(feature = "v1_44")]
87 #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
88 #[doc(alias = "nm_setting_bond_port_get_prio")]
89 #[doc(alias = "get_prio")]
90 pub fn prio(&self) -> i32 {
91 unsafe {
92 ffi::nm_setting_bond_port_get_prio(self.to_glib_none().0)
93 }
94 }
95
96 #[cfg(feature = "v1_34")]
101 #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
102 #[doc(alias = "nm_setting_bond_port_get_queue_id")]
103 #[doc(alias = "get_queue_id")]
104 #[doc(alias = "queue-id")]
105 pub fn queue_id(&self) -> u32 {
106 unsafe {
107 ffi::nm_setting_bond_port_get_queue_id(self.to_glib_none().0)
108 }
109 }
110
111 #[cfg(feature = "v1_44")]
116 #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
117 pub fn set_prio(&self, prio: i32) {
118 ObjectExt::set_property(self,"prio", prio)
119 }
120
121 #[cfg(feature = "v1_34")]
124 #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
125 #[doc(alias = "queue-id")]
126 pub fn set_queue_id(&self, queue_id: u32) {
127 ObjectExt::set_property(self,"queue-id", queue_id)
128 }
129
130 #[cfg(feature = "v1_44")]
131 #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
132 #[doc(alias = "prio")]
133 pub fn connect_prio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
134 unsafe extern "C" fn notify_prio_trampoline<F: Fn(&SettingBondPort) + 'static>(this: *mut ffi::NMSettingBondPort, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
135 let f: &F = &*(f as *const F);
136 f(&from_glib_borrow(this))
137 }
138 unsafe {
139 let f: Box_<F> = Box_::new(f);
140 connect_raw(self.as_ptr() as *mut _, c"notify::prio".as_ptr() as *const _,
141 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_prio_trampoline::<F> as *const ())), Box_::into_raw(f))
142 }
143 }
144
145 #[cfg(feature = "v1_34")]
146 #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
147 #[doc(alias = "queue-id")]
148 pub fn connect_queue_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
149 unsafe extern "C" fn notify_queue_id_trampoline<F: Fn(&SettingBondPort) + 'static>(this: *mut ffi::NMSettingBondPort, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
150 let f: &F = &*(f as *const F);
151 f(&from_glib_borrow(this))
152 }
153 unsafe {
154 let f: Box_<F> = Box_::new(f);
155 connect_raw(self.as_ptr() as *mut _, c"notify::queue-id".as_ptr() as *const _,
156 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_queue_id_trampoline::<F> as *const ())), Box_::into_raw(f))
157 }
158 }
159}
160
161#[cfg(feature = "v1_34")]
162#[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
163impl Default for SettingBondPort {
164 fn default() -> Self {
165 Self::new()
166 }
167 }
168
169#[must_use = "The builder must be built to be used"]
174pub struct SettingBondPortBuilder {
175 builder: glib::object::ObjectBuilder<'static, SettingBondPort>,
176 }
177
178 impl SettingBondPortBuilder {
179 fn new() -> Self {
180 Self { builder: glib::object::Object::builder() }
181 }
182
183 #[cfg(feature = "v1_44")]
188 #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
189 pub fn prio(self, prio: i32) -> Self {
190 Self { builder: self.builder.property("prio", prio), }
191 }
192
193 #[cfg(feature = "v1_34")]
196 #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
197 pub fn queue_id(self, queue_id: u32) -> Self {
198 Self { builder: self.builder.property("queue-id", queue_id), }
199 }
200
201 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
204 pub fn build(self) -> SettingBondPort {
205assert_initialized_main_thread!();
206 self.builder.build() }
207}