gio/auto/socket_connectable.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::{SocketAddressEnumerator, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// conn_error);
10 /// g_object_unref (sockaddr);
11 /// }
12 /// g_object_unref (enumerator);
13 ///
14 /// if (conn)
15 /// {
16 /// if (conn_error)
17 /// {
18 /// // We couldn't connect to the first address, but we succeeded
19 /// // in connecting to a later address.
20 /// g_error_free (conn_error);
21 /// }
22 /// return conn;
23 /// }
24 /// else if (error)
25 /// {
26 /// /// Either initial lookup failed, or else the caller cancelled us.
27 /// if (conn_error)
28 /// g_error_free (conn_error);
29 /// return NULL;
30 /// }
31 /// else
32 /// {
33 /// g_error_propagate (error, conn_error);
34 /// return NULL;
35 /// }
36 /// }
37 /// ```text
38 ///
39 ///
40 /// # Implements
41 ///
42 /// [`SocketConnectableExt`][trait@crate::prelude::SocketConnectableExt]
43 #[doc(alias = "GSocketConnectable")]
44 pub struct SocketConnectable(Interface<ffi::GSocketConnectable, ffi::GSocketConnectableIface>);
45
46 match fn {
47 type_ => || ffi::g_socket_connectable_get_type(),
48 }
49}
50
51impl SocketConnectable {
52 pub const NONE: Option<&'static SocketConnectable> = None;
53}
54
55/// Trait containing all [`struct@SocketConnectable`] methods.
56///
57/// # Implementors
58///
59/// [`InetSocketAddress`][struct@crate::InetSocketAddress], [`NativeSocketAddress`][struct@crate::NativeSocketAddress], [`NetworkAddress`][struct@crate::NetworkAddress], [`NetworkService`][struct@crate::NetworkService], [`ProxyAddress`][struct@crate::ProxyAddress], [`SocketAddress`][struct@crate::SocketAddress], [`SocketConnectable`][struct@crate::SocketConnectable], [`UnixSocketAddress`][struct@crate::UnixSocketAddress]
60pub trait SocketConnectableExt: IsA<SocketConnectable> + 'static {
61 /// Creates a #GSocketAddressEnumerator for @self.
62 ///
63 /// # Returns
64 ///
65 /// a new #GSocketAddressEnumerator.
66 #[doc(alias = "g_socket_connectable_enumerate")]
67 fn enumerate(&self) -> SocketAddressEnumerator {
68 unsafe {
69 from_glib_full(ffi::g_socket_connectable_enumerate(
70 self.as_ref().to_glib_none().0,
71 ))
72 }
73 }
74
75 /// Creates a #GSocketAddressEnumerator for @self that will
76 /// return a #GProxyAddress for each of its addresses that you must connect
77 /// to via a proxy.
78 ///
79 /// If @self does not implement
80 /// g_socket_connectable_proxy_enumerate(), this will fall back to
81 /// calling g_socket_connectable_enumerate().
82 ///
83 /// # Returns
84 ///
85 /// a new #GSocketAddressEnumerator.
86 #[doc(alias = "g_socket_connectable_proxy_enumerate")]
87 fn proxy_enumerate(&self) -> SocketAddressEnumerator {
88 unsafe {
89 from_glib_full(ffi::g_socket_connectable_proxy_enumerate(
90 self.as_ref().to_glib_none().0,
91 ))
92 }
93 }
94
95 /// s type name will be returned as a fallback.
96 ///
97 /// # Returns
98 ///
99 /// the formatted string
100 #[doc(alias = "g_socket_connectable_to_string")]
101 fn to_string(&self) -> glib::GString {
102 unsafe {
103 from_glib_full(ffi::g_socket_connectable_to_string(
104 self.as_ref().to_glib_none().0,
105 ))
106 }
107 }
108}
109
110impl<O: IsA<SocketConnectable>> SocketConnectableExt for O {}