gio/auto/
proxy_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, InetAddress, InetSocketAddress, SocketAddress, SocketConnectable};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GProxyAddress")]
10    pub struct ProxyAddress(Object<ffi::GProxyAddress, ffi::GProxyAddressClass>) @extends InetSocketAddress, SocketAddress, @implements SocketConnectable;
11
12    match fn {
13        type_ => || ffi::g_proxy_address_get_type(),
14    }
15}
16
17impl ProxyAddress {
18    pub const NONE: Option<&'static ProxyAddress> = None;
19
20    #[doc(alias = "g_proxy_address_new")]
21    pub fn new(
22        inetaddr: &impl IsA<InetAddress>,
23        port: u16,
24        protocol: &str,
25        dest_hostname: &str,
26        dest_port: u16,
27        username: Option<&str>,
28        password: Option<&str>,
29    ) -> ProxyAddress {
30        unsafe {
31            SocketAddress::from_glib_full(ffi::g_proxy_address_new(
32                inetaddr.as_ref().to_glib_none().0,
33                port,
34                protocol.to_glib_none().0,
35                dest_hostname.to_glib_none().0,
36                dest_port,
37                username.to_glib_none().0,
38                password.to_glib_none().0,
39            ))
40            .unsafe_cast()
41        }
42    }
43}
44
45unsafe impl Send for ProxyAddress {}
46unsafe impl Sync for ProxyAddress {}
47
48pub trait ProxyAddressExt: IsA<ProxyAddress> + 'static {
49    #[doc(alias = "g_proxy_address_get_destination_hostname")]
50    #[doc(alias = "get_destination_hostname")]
51    #[doc(alias = "destination-hostname")]
52    fn destination_hostname(&self) -> glib::GString {
53        unsafe {
54            from_glib_none(ffi::g_proxy_address_get_destination_hostname(
55                self.as_ref().to_glib_none().0,
56            ))
57        }
58    }
59
60    #[doc(alias = "g_proxy_address_get_destination_port")]
61    #[doc(alias = "get_destination_port")]
62    #[doc(alias = "destination-port")]
63    fn destination_port(&self) -> u16 {
64        unsafe { ffi::g_proxy_address_get_destination_port(self.as_ref().to_glib_none().0) }
65    }
66
67    #[doc(alias = "g_proxy_address_get_destination_protocol")]
68    #[doc(alias = "get_destination_protocol")]
69    #[doc(alias = "destination-protocol")]
70    fn destination_protocol(&self) -> glib::GString {
71        unsafe {
72            from_glib_none(ffi::g_proxy_address_get_destination_protocol(
73                self.as_ref().to_glib_none().0,
74            ))
75        }
76    }
77
78    #[doc(alias = "g_proxy_address_get_password")]
79    #[doc(alias = "get_password")]
80    fn password(&self) -> Option<glib::GString> {
81        unsafe {
82            from_glib_none(ffi::g_proxy_address_get_password(
83                self.as_ref().to_glib_none().0,
84            ))
85        }
86    }
87
88    #[doc(alias = "g_proxy_address_get_protocol")]
89    #[doc(alias = "get_protocol")]
90    fn protocol(&self) -> glib::GString {
91        unsafe {
92            from_glib_none(ffi::g_proxy_address_get_protocol(
93                self.as_ref().to_glib_none().0,
94            ))
95        }
96    }
97
98    #[doc(alias = "g_proxy_address_get_uri")]
99    #[doc(alias = "get_uri")]
100    fn uri(&self) -> Option<glib::GString> {
101        unsafe { from_glib_none(ffi::g_proxy_address_get_uri(self.as_ref().to_glib_none().0)) }
102    }
103
104    #[doc(alias = "g_proxy_address_get_username")]
105    #[doc(alias = "get_username")]
106    fn username(&self) -> Option<glib::GString> {
107        unsafe {
108            from_glib_none(ffi::g_proxy_address_get_username(
109                self.as_ref().to_glib_none().0,
110            ))
111        }
112    }
113}
114
115impl<O: IsA<ProxyAddress>> ProxyAddressExt for O {}