nm_rs/auto/
tc_action.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
6use crate::{ffi};
7#[cfg(feature = "v1_12")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
9use glib::{translate::*};
10
11glib::wrapper! {
12    #[derive(Debug, PartialOrd, Ord, Hash)]
13    pub struct TCAction(Shared<ffi::NMTCAction>);
14
15    match fn {
16        ref => |ptr| ffi::nm_tc_action_ref(ptr),
17        unref => |ptr| ffi::nm_tc_action_unref(ptr),
18        type_ => || ffi::nm_tc_action_get_type(),
19    }
20}
21
22impl TCAction {
23    /// Creates a new #NMTCAction object.
24    /// ## `kind`
25    /// name of the queueing discipline
26    ///
27    /// # Returns
28    ///
29    /// the new #NMTCAction object, or [`None`] on error
30    #[cfg(feature = "v1_12")]
31    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
32    #[doc(alias = "nm_tc_action_new")]
33    pub fn new(kind: &str) -> Result<TCAction, glib::Error> {
34        assert_initialized_main_thread!();
35        unsafe {
36            let mut error = std::ptr::null_mut();
37            let ret = ffi::nm_tc_action_new(kind.to_glib_none().0, &mut error);
38            if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
39        }
40    }
41
42    /// Creates a copy of @self
43    ///
44    /// # Returns
45    ///
46    /// a copy of @self
47    #[cfg(feature = "v1_12")]
48    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
49    #[doc(alias = "nm_tc_action_dup")]
50#[must_use]
51    pub fn dup(&self) -> TCAction {
52        unsafe {
53            from_glib_full(ffi::nm_tc_action_dup(self.to_glib_none().0))
54        }
55    }
56
57    #[cfg(feature = "v1_12")]
58    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
59    #[doc(alias = "nm_tc_action_equal")]
60     fn equal(&self, other: &TCAction) -> bool {
61        unsafe {
62            from_glib(ffi::nm_tc_action_equal(self.to_glib_none().0, other.to_glib_none().0))
63        }
64    }
65
66    //#[cfg(feature = "v1_12")]
67    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
68    //#[doc(alias = "nm_tc_action_get_attribute")]
69    //#[doc(alias = "get_attribute")]
70    //pub fn attribute(&self, name: &str) -> /*Ignored*/glib::Variant {
71    //    unsafe { TODO: call ffi:nm_tc_action_get_attribute() }
72    //}
73
74    /// Gets an array of attribute names defined on @self.
75    ///
76    /// # Returns
77    ///
78    /// a [`None`]-terminated array of attribute names,
79    #[cfg(feature = "v1_12")]
80    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
81    #[doc(alias = "nm_tc_action_get_attribute_names")]
82    #[doc(alias = "get_attribute_names")]
83    pub fn attribute_names(&self) -> Vec<glib::GString> {
84        unsafe {
85            FromGlibPtrContainer::from_glib_full(ffi::nm_tc_action_get_attribute_names(self.to_glib_none().0))
86        }
87    }
88
89    #[cfg(feature = "v1_12")]
90    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
91    #[doc(alias = "nm_tc_action_get_kind")]
92    #[doc(alias = "get_kind")]
93    pub fn kind(&self) -> glib::GString {
94        unsafe {
95            from_glib_none(ffi::nm_tc_action_get_kind(self.to_glib_none().0))
96        }
97    }
98
99    //#[cfg(feature = "v1_12")]
100    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
101    //#[doc(alias = "nm_tc_action_set_attribute")]
102    //pub fn set_attribute(&self, name: &str, value: /*Ignored*/Option<&glib::Variant>) {
103    //    unsafe { TODO: call ffi:nm_tc_action_set_attribute() }
104    //}
105}
106
107#[cfg(feature = "v1_12")]
108#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
109impl PartialEq for TCAction {
110    #[inline]
111    fn eq(&self, other: &Self) -> bool {
112        self.equal(other)
113    }
114}
115#[cfg(feature = "v1_12")]
116#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
117
118impl Eq for TCAction {}