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 5 use crate::SocketAddress; 6 use crate::SocketConnectable; 7 use crate::UnixSocketAddressType; 8 use glib::object::IsA; 9 use glib::translate::*; 10 use glib::StaticType; 11 use std::fmt; 12 13 glib::wrapper! { 14 #[doc(alias = "GUnixSocketAddress")] 15 pub struct UnixSocketAddress(Object<ffi::GUnixSocketAddress, ffi::GUnixSocketAddressClass>) @extends SocketAddress, @implements SocketConnectable; 16 17 match fn { 18 type_ => || ffi::g_unix_socket_address_get_type(), 19 } 20 } 21 22 impl UnixSocketAddress { 23 //#[doc(alias = "g_unix_socket_address_new_abstract")] 24 //pub fn new_abstract(path: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 10 }) -> UnixSocketAddress { 25 // unsafe { TODO: call ffi:g_unix_socket_address_new_abstract() } 26 //} 27 28 //#[doc(alias = "g_unix_socket_address_new_with_type")] 29 //#[doc(alias = "new_with_type")] 30 //pub fn with_type(path: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 10 }, type_: UnixSocketAddressType) -> UnixSocketAddress { 31 // unsafe { TODO: call ffi:g_unix_socket_address_new_with_type() } 32 //} 33 34 #[doc(alias = "g_unix_socket_address_abstract_names_supported")] abstract_names_supported() -> bool35 pub fn abstract_names_supported() -> bool { 36 unsafe { from_glib(ffi::g_unix_socket_address_abstract_names_supported()) } 37 } 38 } 39 40 unsafe impl Send for UnixSocketAddress {} 41 unsafe impl Sync for UnixSocketAddress {} 42 43 pub const NONE_UNIX_SOCKET_ADDRESS: Option<&UnixSocketAddress> = None; 44 45 pub trait UnixSocketAddressExt: 'static { 46 #[doc(alias = "g_unix_socket_address_get_address_type")] 47 #[doc(alias = "get_address_type")] address_type(&self) -> UnixSocketAddressType48 fn address_type(&self) -> UnixSocketAddressType; 49 50 #[doc(alias = "g_unix_socket_address_get_is_abstract")] 51 #[doc(alias = "get_is_abstract")] is_abstract(&self) -> bool52 fn is_abstract(&self) -> bool; 53 54 #[doc(alias = "g_unix_socket_address_get_path_len")] 55 #[doc(alias = "get_path_len")] path_len(&self) -> usize56 fn path_len(&self) -> usize; 57 58 #[doc(alias = "path-as-array")] path_as_array(&self) -> Option<glib::ByteArray>59 fn path_as_array(&self) -> Option<glib::ByteArray>; 60 } 61 62 impl<O: IsA<UnixSocketAddress>> UnixSocketAddressExt for O { address_type(&self) -> UnixSocketAddressType63 fn address_type(&self) -> UnixSocketAddressType { 64 unsafe { 65 from_glib(ffi::g_unix_socket_address_get_address_type( 66 self.as_ref().to_glib_none().0, 67 )) 68 } 69 } 70 is_abstract(&self) -> bool71 fn is_abstract(&self) -> bool { 72 unsafe { 73 from_glib(ffi::g_unix_socket_address_get_is_abstract( 74 self.as_ref().to_glib_none().0, 75 )) 76 } 77 } 78 path_len(&self) -> usize79 fn path_len(&self) -> usize { 80 unsafe { ffi::g_unix_socket_address_get_path_len(self.as_ref().to_glib_none().0) } 81 } 82 path_as_array(&self) -> Option<glib::ByteArray>83 fn path_as_array(&self) -> Option<glib::ByteArray> { 84 unsafe { 85 let mut value = glib::Value::from_type(<glib::ByteArray as StaticType>::static_type()); 86 glib::gobject_ffi::g_object_get_property( 87 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 88 b"path-as-array\0".as_ptr() as *const _, 89 value.to_glib_none_mut().0, 90 ); 91 value 92 .get() 93 .expect("Return Value for property `path-as-array` getter") 94 } 95 } 96 } 97 98 impl fmt::Display for UnixSocketAddress { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result99 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 100 f.write_str("UnixSocketAddress") 101 } 102 } 103