gio/auto/unix_socket_address.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::{SocketAddress, SocketConnectable, UnixSocketAddressType, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// ` belonged to the UNIX-specific
10 /// GIO interfaces, thus you had to use the `gio-unix-2.0.pc` pkg-config file
11 /// when using it. This is no longer necessary since GLib 2.72.
12 ///
13 /// ## Properties
14 ///
15 ///
16 /// #### `abstract`
17 /// Whether or not this is an abstract address
18 ///
19 /// Readable | Writable | Construct Only
20 ///
21 ///
22 /// #### `address-type`
23 /// The type of Unix socket address.
24 ///
25 /// Readable | Writable | Construct Only
26 ///
27 ///
28 /// #### `path`
29 /// Unix socket path.
30 ///
31 /// Readable | Writable | Construct Only
32 ///
33 ///
34 /// #### `path-as-array`
35 /// Unix socket path, as a byte array.
36 ///
37 /// Readable | Writable | Construct Only
38 /// <details><summary><h4>SocketAddress</h4></summary>
39 ///
40 ///
41 /// #### `family`
42 /// The family of the socket address.
43 ///
44 /// Readable
45 /// </details>
46 ///
47 /// # Implements
48 ///
49 /// [`UnixSocketAddressExt`][trait@crate::prelude::UnixSocketAddressExt], [`SocketAddressExt`][trait@crate::prelude::SocketAddressExt], [`trait@glib::ObjectExt`], [`SocketConnectableExt`][trait@crate::prelude::SocketConnectableExt], [`UnixSocketAddressExtManual`][trait@crate::prelude::UnixSocketAddressExtManual]
50 #[doc(alias = "GUnixSocketAddress")]
51 pub struct UnixSocketAddress(Object<ffi::GUnixSocketAddress, ffi::GUnixSocketAddressClass>) @extends SocketAddress, @implements SocketConnectable;
52
53 match fn {
54 type_ => || ffi::g_unix_socket_address_get_type(),
55 }
56}
57
58impl UnixSocketAddress {
59 pub const NONE: Option<&'static UnixSocketAddress> = None;
60
61 //#[doc(alias = "g_unix_socket_address_new_abstract")]
62 //pub fn new_abstract(path: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 10 }) -> UnixSocketAddress {
63 // unsafe { TODO: call ffi:g_unix_socket_address_new_abstract() }
64 //}
65
66 //#[doc(alias = "g_unix_socket_address_new_with_type")]
67 //#[doc(alias = "new_with_type")]
68 //pub fn with_type(path: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 10 }, type_: UnixSocketAddressType) -> UnixSocketAddress {
69 // unsafe { TODO: call ffi:g_unix_socket_address_new_with_type() }
70 //}
71
72 /// Checks if abstract UNIX domain socket names are supported.
73 ///
74 /// # Returns
75 ///
76 /// [`true`] if supported, [`false`] otherwise
77 #[doc(alias = "g_unix_socket_address_abstract_names_supported")]
78 pub fn abstract_names_supported() -> bool {
79 unsafe { from_glib(ffi::g_unix_socket_address_abstract_names_supported()) }
80 }
81}
82
83unsafe impl Send for UnixSocketAddress {}
84unsafe impl Sync for UnixSocketAddress {}
85
86/// Trait containing all [`struct@UnixSocketAddress`] methods.
87///
88/// # Implementors
89///
90/// [`UnixSocketAddress`][struct@crate::UnixSocketAddress]
91pub trait UnixSocketAddressExt: IsA<UnixSocketAddress> + 'static {
92 /// Gets @self's type.
93 ///
94 /// # Returns
95 ///
96 /// a #GUnixSocketAddressType
97 #[doc(alias = "g_unix_socket_address_get_address_type")]
98 #[doc(alias = "get_address_type")]
99 #[doc(alias = "address-type")]
100 fn address_type(&self) -> UnixSocketAddressType {
101 unsafe {
102 from_glib(ffi::g_unix_socket_address_get_address_type(
103 self.as_ref().to_glib_none().0,
104 ))
105 }
106 }
107
108 /// Tests if @self is abstract.
109 ///
110 /// # Deprecated
111 ///
112 /// Use g_unix_socket_address_get_address_type()
113 ///
114 /// # Returns
115 ///
116 /// [`true`] if the address is abstract, [`false`] otherwise
117 #[doc(alias = "g_unix_socket_address_get_is_abstract")]
118 #[doc(alias = "get_is_abstract")]
119 fn is_abstract(&self) -> bool {
120 unsafe {
121 from_glib(ffi::g_unix_socket_address_get_is_abstract(
122 self.as_ref().to_glib_none().0,
123 ))
124 }
125 }
126
127 /// Gets the length of @self's path.
128 ///
129 /// For details, see g_unix_socket_address_get_path().
130 ///
131 /// # Returns
132 ///
133 /// the length of the path
134 #[doc(alias = "g_unix_socket_address_get_path_len")]
135 #[doc(alias = "get_path_len")]
136 fn path_len(&self) -> usize {
137 unsafe { ffi::g_unix_socket_address_get_path_len(self.as_ref().to_glib_none().0) }
138 }
139
140 /// Unix socket path, as a byte array.
141 #[doc(alias = "path-as-array")]
142 fn path_as_array(&self) -> Option<glib::ByteArray> {
143 ObjectExt::property(self.as_ref(), "path-as-array")
144 }
145}
146
147impl<O: IsA<UnixSocketAddress>> UnixSocketAddressExt for O {}