nm_rs/auto/
tc_qdisc.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 TCQdisc(Shared<ffi::NMTCQdisc>);
14
15    match fn {
16        ref => |ptr| ffi::nm_tc_qdisc_ref(ptr),
17        unref => |ptr| ffi::nm_tc_qdisc_unref(ptr),
18        type_ => || ffi::nm_tc_qdisc_get_type(),
19    }
20}
21
22impl TCQdisc {
23    /// Creates a new #NMTCQdisc object.
24    /// ## `kind`
25    /// name of the queueing discipline
26    /// ## `parent`
27    /// the parent queueing discipline
28    ///
29    /// # Returns
30    ///
31    /// the new #NMTCQdisc object, or [`None`] on error
32    #[cfg(feature = "v1_12")]
33    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
34    #[doc(alias = "nm_tc_qdisc_new")]
35    pub fn new(kind: &str, parent: u32) -> Result<TCQdisc, glib::Error> {
36        assert_initialized_main_thread!();
37        unsafe {
38            let mut error = std::ptr::null_mut();
39            let ret = ffi::nm_tc_qdisc_new(kind.to_glib_none().0, parent, &mut error);
40            if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
41        }
42    }
43
44    /// Creates a copy of @self
45    ///
46    /// # Returns
47    ///
48    /// a copy of @self
49    #[cfg(feature = "v1_12")]
50    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
51    #[doc(alias = "nm_tc_qdisc_dup")]
52#[must_use]
53    pub fn dup(&self) -> TCQdisc {
54        unsafe {
55            from_glib_full(ffi::nm_tc_qdisc_dup(self.to_glib_none().0))
56        }
57    }
58
59    #[cfg(feature = "v1_12")]
60    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
61    #[doc(alias = "nm_tc_qdisc_equal")]
62     fn equal(&self, other: &TCQdisc) -> bool {
63        unsafe {
64            from_glib(ffi::nm_tc_qdisc_equal(self.to_glib_none().0, other.to_glib_none().0))
65        }
66    }
67
68    //#[cfg(feature = "v1_18")]
69    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
70    //#[doc(alias = "nm_tc_qdisc_get_attribute")]
71    //#[doc(alias = "get_attribute")]
72    //pub fn attribute(&self, name: &str) -> /*Ignored*/glib::Variant {
73    //    unsafe { TODO: call ffi:nm_tc_qdisc_get_attribute() }
74    //}
75
76    /// Gets an array of attribute names defined on @self.
77    ///
78    /// # Returns
79    ///
80    /// a [`None`]-terminated array of attribute names
81    ///   or [`None`] if no attributes are set.
82    #[cfg(feature = "v1_18")]
83    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
84    #[doc(alias = "nm_tc_qdisc_get_attribute_names")]
85    #[doc(alias = "get_attribute_names")]
86    pub fn attribute_names(&self) -> Vec<glib::GString> {
87        unsafe {
88            FromGlibPtrContainer::from_glib_container(ffi::nm_tc_qdisc_get_attribute_names(self.to_glib_none().0))
89        }
90    }
91
92    ///
93    /// # Returns
94    ///
95    /// the queueing discipline handle
96    #[cfg(feature = "v1_12")]
97    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
98    #[doc(alias = "nm_tc_qdisc_get_handle")]
99    #[doc(alias = "get_handle")]
100    pub fn handle(&self) -> u32 {
101        unsafe {
102            ffi::nm_tc_qdisc_get_handle(self.to_glib_none().0)
103        }
104    }
105
106    #[cfg(feature = "v1_12")]
107    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
108    #[doc(alias = "nm_tc_qdisc_get_kind")]
109    #[doc(alias = "get_kind")]
110    pub fn kind(&self) -> glib::GString {
111        unsafe {
112            from_glib_none(ffi::nm_tc_qdisc_get_kind(self.to_glib_none().0))
113        }
114    }
115
116    ///
117    /// # Returns
118    ///
119    /// the parent class
120    #[cfg(feature = "v1_12")]
121    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
122    #[doc(alias = "nm_tc_qdisc_get_parent")]
123    #[doc(alias = "get_parent")]
124    pub fn parent(&self) -> u32 {
125        unsafe {
126            ffi::nm_tc_qdisc_get_parent(self.to_glib_none().0)
127        }
128    }
129
130    //#[cfg(feature = "v1_18")]
131    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
132    //#[doc(alias = "nm_tc_qdisc_set_attribute")]
133    //pub fn set_attribute(&self, name: &str, value: /*Ignored*/Option<&glib::Variant>) {
134    //    unsafe { TODO: call ffi:nm_tc_qdisc_set_attribute() }
135    //}
136
137    /// Sets the queueing discipline handle.
138    /// ## `handle`
139    /// the queueing discipline handle
140    #[cfg(feature = "v1_12")]
141    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
142    #[doc(alias = "nm_tc_qdisc_set_handle")]
143    pub fn set_handle(&self, handle: u32) {
144        unsafe {
145            ffi::nm_tc_qdisc_set_handle(self.to_glib_none().0, handle);
146        }
147    }
148}
149
150#[cfg(feature = "v1_12")]
151#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
152impl PartialEq for TCQdisc {
153    #[inline]
154    fn eq(&self, other: &Self) -> bool {
155        self.equal(other)
156    }
157}
158#[cfg(feature = "v1_12")]
159#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
160
161impl Eq for TCQdisc {}