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