1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir
// from gtk-girs (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#![allow(deprecated)]
use crate::{ffi,Setting,Ternary};
use glib::{prelude::*,translate::*};
glib::wrapper! {
/// Ethtool Ethernet Settings
///
/// # Implements
///
/// [`SettingExt`][trait@crate::prelude::SettingExt]
#[doc(alias = "NMSettingEthtool")]
pub struct SettingEthtool(Object<ffi::NMSettingEthtool, ffi::NMSettingEthtoolClass>) @extends Setting;
match fn {
type_ => || ffi::nm_setting_ethtool_get_type(),
}
}
impl SettingEthtool {
/// Creates a new #NMSettingEthtool object with default values.
///
/// # Returns
///
/// the new empty #NMSettingEthtool object
#[doc(alias = "nm_setting_ethtool_new")]
pub fn new() -> SettingEthtool {
assert_initialized_main_thread!();
unsafe {
Setting::from_glib_full(ffi::nm_setting_ethtool_new()).unsafe_cast()
}
}
/// Clears all offload features settings
///
/// # Deprecated since 1.26
///
/// use nm_setting_option_clear_by_name() with nm_ethtool_optname_is_feature() predicate instead.
#[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")]
#[allow(deprecated)]
#[doc(alias = "nm_setting_ethtool_clear_features")]
pub fn clear_features(&self) {
unsafe {
ffi::nm_setting_ethtool_clear_features(self.to_glib_none().0);
}
}
/// Gets and offload feature setting. Returns [`Ternary::Default`][crate::Ternary::Default] if the
/// feature is not set.
///
/// Note that @optname must be a valid name for a feature, according to
/// nm_ethtool_optname_is_feature().
///
/// # Deprecated since 1.26
///
/// use nm_setting_option_get_boolean() instead.
/// ## `optname`
/// option name of the offload feature to get
///
/// # Returns
///
/// a #NMTernary value indicating whether the offload feature
/// is enabled, disabled, or left untouched.
#[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")]
#[allow(deprecated)]
#[doc(alias = "nm_setting_ethtool_get_feature")]
#[doc(alias = "get_feature")]
pub fn feature(&self, optname: &str) -> Ternary {
unsafe {
from_glib(ffi::nm_setting_ethtool_get_feature(self.to_glib_none().0, optname.to_glib_none().0))
}
}
/// This returns all options names that are set. This includes the feature names
/// like [`ETHTOOL_OPTNAME_FEATURE_GRO`][crate::ETHTOOL_OPTNAME_FEATURE_GRO]. See nm_ethtool_optname_is_feature() to
/// check whether the option name is valid for offload features.
///
/// # Deprecated since 1.26
///
/// use nm_setting_option_get_all_names() instead.
///
/// # Returns
///
/// list of set option
/// names or [`None`] if no options are set. The option names are still owned by
/// @self and may get invalidated when @self gets modified.
///
/// ## `out_length`
/// return location for the number of keys returned, or [`None`]
#[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")]
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[allow(deprecated)]
#[doc(alias = "nm_setting_ethtool_get_optnames")]
#[doc(alias = "get_optnames")]
pub fn optnames(&self) -> (Vec<glib::GString>, u32) {
unsafe {
let mut out_length = std::mem::MaybeUninit::uninit();
let ret = FromGlibPtrContainer::from_glib_container(ffi::nm_setting_ethtool_get_optnames(self.to_glib_none().0, out_length.as_mut_ptr()));
(ret, out_length.assume_init())
}
}
/// Sets and offload feature setting.
///
/// Note that @optname must be a valid name for a feature, according to
/// nm_ethtool_optname_is_feature().
///
/// # Deprecated since 1.26
///
/// use nm_setting_option_set() or nm_setting_option_set_boolean() instead.
/// ## `optname`
/// option name of the offload feature to get
/// ## `value`
/// the new value to set. The special value [`Ternary::Default`][crate::Ternary::Default]
/// means to clear the offload feature setting.
#[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")]
#[allow(deprecated)]
#[doc(alias = "nm_setting_ethtool_set_feature")]
pub fn set_feature(&self, optname: &str, value: Ternary) {
unsafe {
ffi::nm_setting_ethtool_set_feature(self.to_glib_none().0, optname.to_glib_none().0, value.into_glib());
}
}
}
#[cfg(feature = "v1_14")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_14")))]
impl Default for SettingEthtool {
fn default() -> Self {
Self::new()
}
}