gio/auto/
socket_connectable.rs1use gio_sys;
6use glib::object::IsA;
7use glib::translate::*;
8#[cfg(any(feature = "v2_48", feature = "dox"))]
9use glib::GString;
10use std::fmt;
11use SocketAddressEnumerator;
12
13glib_wrapper! {
14 pub struct SocketConnectable(Interface<gio_sys::GSocketConnectable>);
15
16 match fn {
17 get_type => || gio_sys::g_socket_connectable_get_type(),
18 }
19}
20
21pub const NONE_SOCKET_CONNECTABLE: Option<&SocketConnectable> = None;
22
23pub trait SocketConnectableExt: 'static {
24 fn enumerate(&self) -> Option<SocketAddressEnumerator>;
25
26 fn proxy_enumerate(&self) -> Option<SocketAddressEnumerator>;
27
28 #[cfg(any(feature = "v2_48", feature = "dox"))]
29 fn to_string(&self) -> Option<GString>;
30}
31
32impl<O: IsA<SocketConnectable>> SocketConnectableExt for O {
33 fn enumerate(&self) -> Option<SocketAddressEnumerator> {
34 unsafe {
35 from_glib_full(gio_sys::g_socket_connectable_enumerate(
36 self.as_ref().to_glib_none().0,
37 ))
38 }
39 }
40
41 fn proxy_enumerate(&self) -> Option<SocketAddressEnumerator> {
42 unsafe {
43 from_glib_full(gio_sys::g_socket_connectable_proxy_enumerate(
44 self.as_ref().to_glib_none().0,
45 ))
46 }
47 }
48
49 #[cfg(any(feature = "v2_48", feature = "dox"))]
50 fn to_string(&self) -> Option<GString> {
51 unsafe {
52 from_glib_full(gio_sys::g_socket_connectable_to_string(
53 self.as_ref().to_glib_none().0,
54 ))
55 }
56 }
57}
58
59impl fmt::Display for SocketConnectable {
60 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
61 write!(f, "SocketConnectable")
62 }
63}