gio/auto/unix_fd_list.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// ` belonged to the UNIX-specific GIO
10 /// interfaces, thus you had to use the `gio-unix-2.0.pc` pkg-config file when
11 /// using it.
12 ///
13 /// Since 2.74, the API is available for Windows.
14 ///
15 /// # Implements
16 ///
17 /// [`UnixFDListExt`][trait@crate::prelude::UnixFDListExt], [`trait@glib::ObjectExt`], [`UnixFDListExtManual`][trait@crate::prelude::UnixFDListExtManual]
18 #[doc(alias = "GUnixFDList")]
19 pub struct UnixFDList(Object<ffi::GUnixFDList, ffi::GUnixFDListClass>);
20
21 match fn {
22 type_ => || ffi::g_unix_fd_list_get_type(),
23 }
24}
25
26impl UnixFDList {
27 pub const NONE: Option<&'static UnixFDList> = None;
28
29 /// Creates a new #GUnixFDList containing no file descriptors.
30 ///
31 /// # Returns
32 ///
33 /// a new #GUnixFDList
34 #[doc(alias = "g_unix_fd_list_new")]
35 pub fn new() -> UnixFDList {
36 unsafe { from_glib_full(ffi::g_unix_fd_list_new()) }
37 }
38}
39
40impl Default for UnixFDList {
41 fn default() -> Self {
42 Self::new()
43 }
44}
45
46/// Trait containing all [`struct@UnixFDList`] methods.
47///
48/// # Implementors
49///
50/// [`UnixFDList`][struct@crate::UnixFDList]
51pub trait UnixFDListExt: IsA<UnixFDList> + 'static {
52 /// Gets the length of @self (ie: the number of file descriptors
53 /// contained within).
54 ///
55 /// # Returns
56 ///
57 /// the length of @self
58 #[doc(alias = "g_unix_fd_list_get_length")]
59 #[doc(alias = "get_length")]
60 fn length(&self) -> i32 {
61 unsafe { ffi::g_unix_fd_list_get_length(self.as_ref().to_glib_none().0) }
62 }
63}
64
65impl<O: IsA<UnixFDList>> UnixFDListExt for O {}