nm_rs/auto/
setting_ovs_other_config.rs1use crate::{ffi,Setting};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 #[doc(alias = "NMSettingOvsOtherConfig")]
37 pub struct SettingOvsOtherConfig(Object<ffi::NMSettingOvsOtherConfig, ffi::NMSettingOvsOtherConfigClass>) @extends Setting;
38
39 match fn {
40 type_ => || ffi::nm_setting_ovs_other_config_get_type(),
41 }
42}
43
44impl SettingOvsOtherConfig {
45 #[doc(alias = "nm_setting_ovs_other_config_new")]
52 pub fn new() -> SettingOvsOtherConfig {
53 assert_initialized_main_thread!();
54 unsafe {
55 from_glib_full(ffi::nm_setting_ovs_other_config_new())
56 }
57 }
58
59 pub fn builder() -> SettingOvsOtherConfigBuilder {
64 SettingOvsOtherConfigBuilder::new()
65 }
66
67
68 #[doc(alias = "nm_setting_ovs_other_config_get_data")]
76 #[doc(alias = "get_data")]
77 pub fn data(&self, key: &str) -> glib::GString {
78 unsafe {
79 from_glib_none(ffi::nm_setting_ovs_other_config_get_data(self.to_glib_none().0, key.to_glib_none().0))
80 }
81 }
82
83 #[doc(alias = "nm_setting_ovs_other_config_get_data_keys")]
89 #[doc(alias = "get_data_keys")]
90 pub fn data_keys(&self) -> Vec<glib::GString> {
91 unsafe {
92 let mut out_len = std::mem::MaybeUninit::uninit();
93 let ret = FromGlibContainer::from_glib_none_num(ffi::nm_setting_ovs_other_config_get_data_keys(self.to_glib_none().0, out_len.as_mut_ptr()), out_len.assume_init() as _);
94 ret
95 }
96 }
97
98 #[doc(alias = "nm_setting_ovs_other_config_set_data")]
103 #[doc(alias = "data")]
104 pub fn set_data(&self, key: &str, val: Option<&str>) {
105 unsafe {
106 ffi::nm_setting_ovs_other_config_set_data(self.to_glib_none().0, key.to_glib_none().0, val.to_glib_none().0);
107 }
108 }
109
110 #[cfg(feature = "v1_42")]
111 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
112 #[doc(alias = "data")]
113 pub fn connect_data_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
114 unsafe extern "C" fn notify_data_trampoline<F: Fn(&SettingOvsOtherConfig) + 'static>(this: *mut ffi::NMSettingOvsOtherConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
115 let f: &F = &*(f as *const F);
116 f(&from_glib_borrow(this))
117 }
118 unsafe {
119 let f: Box_<F> = Box_::new(f);
120 connect_raw(self.as_ptr() as *mut _, c"notify::data".as_ptr() as *const _,
121 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_data_trampoline::<F> as *const ())), Box_::into_raw(f))
122 }
123 }
124}
125
126#[cfg(feature = "v1_42")]
127#[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
128impl Default for SettingOvsOtherConfig {
129 fn default() -> Self {
130 Self::new()
131 }
132 }
133
134#[must_use = "The builder must be built to be used"]
139pub struct SettingOvsOtherConfigBuilder {
140 builder: glib::object::ObjectBuilder<'static, SettingOvsOtherConfig>,
141 }
142
143 impl SettingOvsOtherConfigBuilder {
144 fn new() -> Self {
145 Self { builder: glib::object::Object::builder() }
146 }
147
148 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
150 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
157 pub fn build(self) -> SettingOvsOtherConfig {
158assert_initialized_main_thread!();
159 self.builder.build() }
160}