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::{ffi, SocketAddress, SocketConnectable, UnixSocketAddressType};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GUnixSocketAddress")]
10    pub struct UnixSocketAddress(Object<ffi::GUnixSocketAddress, ffi::GUnixSocketAddressClass>) @extends SocketAddress, @implements SocketConnectable;
11
12    match fn {
13        type_ => || ffi::g_unix_socket_address_get_type(),
14    }
15}
16
17impl UnixSocketAddress {
18    pub const NONE: Option<&'static UnixSocketAddress> = None;
19
20    //#[doc(alias = "g_unix_socket_address_new_abstract")]
21    //pub fn new_abstract(path: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 10 }) -> UnixSocketAddress {
22    //    unsafe { TODO: call ffi:g_unix_socket_address_new_abstract() }
23    //}
24
25    //#[doc(alias = "g_unix_socket_address_new_with_type")]
26    //#[doc(alias = "new_with_type")]
27    //pub fn with_type(path: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 10 }, type_: UnixSocketAddressType) -> UnixSocketAddress {
28    //    unsafe { TODO: call ffi:g_unix_socket_address_new_with_type() }
29    //}
30
31    #[doc(alias = "g_unix_socket_address_abstract_names_supported")]
32    pub fn abstract_names_supported() -> bool {
33        unsafe { from_glib(ffi::g_unix_socket_address_abstract_names_supported()) }
34    }
35}
36
37unsafe impl Send for UnixSocketAddress {}
38unsafe impl Sync for UnixSocketAddress {}
39
40pub trait UnixSocketAddressExt: IsA<UnixSocketAddress> + 'static {
41    #[doc(alias = "g_unix_socket_address_get_address_type")]
42    #[doc(alias = "get_address_type")]
43    #[doc(alias = "address-type")]
44    fn address_type(&self) -> UnixSocketAddressType {
45        unsafe {
46            from_glib(ffi::g_unix_socket_address_get_address_type(
47                self.as_ref().to_glib_none().0,
48            ))
49        }
50    }
51
52    #[doc(alias = "g_unix_socket_address_get_is_abstract")]
53    #[doc(alias = "get_is_abstract")]
54    fn is_abstract(&self) -> bool {
55        unsafe {
56            from_glib(ffi::g_unix_socket_address_get_is_abstract(
57                self.as_ref().to_glib_none().0,
58            ))
59        }
60    }
61
62    #[doc(alias = "g_unix_socket_address_get_path_len")]
63    #[doc(alias = "get_path_len")]
64    fn path_len(&self) -> usize {
65        unsafe { ffi::g_unix_socket_address_get_path_len(self.as_ref().to_glib_none().0) }
66    }
67
68    #[doc(alias = "path-as-array")]
69    fn path_as_array(&self) -> Option<glib::ByteArray> {
70        ObjectExt::property(self.as_ref(), "path-as-array")
71    }
72}
73
74impl<O: IsA<UnixSocketAddress>> UnixSocketAddressExt for O {}