gio/
simple_proxy_resolver.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::{prelude::*, translate::*};
4
5use crate::{ffi, ProxyResolver, SimpleProxyResolver};
6
7impl SimpleProxyResolver {
8    #[doc(alias = "g_simple_proxy_resolver_new")]
9    #[allow(clippy::new_ret_no_self)]
10    pub fn new(default_proxy: Option<&str>, ignore_hosts: impl IntoStrV) -> ProxyResolver {
11        unsafe {
12            ignore_hosts.run_with_strv(|ignore_hosts| {
13                from_glib_full(ffi::g_simple_proxy_resolver_new(
14                    default_proxy.to_glib_none().0,
15                    ignore_hosts.as_ptr() as *mut _,
16                ))
17            })
18        }
19    }
20}
21
22mod sealed {
23    pub trait Sealed {}
24    impl<T: super::IsA<super::SimpleProxyResolver>> Sealed for T {}
25}
26
27pub trait SimpleProxyResolverExtManual:
28    sealed::Sealed + IsA<SimpleProxyResolver> + 'static
29{
30    #[doc(alias = "g_simple_proxy_resolver_set_ignore_hosts")]
31    fn set_ignore_hosts(&self, ignore_hosts: impl IntoStrV) {
32        unsafe {
33            ignore_hosts.run_with_strv(|ignore_hosts| {
34                ffi::g_simple_proxy_resolver_set_ignore_hosts(
35                    self.as_ref().to_glib_none().0,
36                    ignore_hosts.as_ptr() as *mut _,
37                );
38            })
39        }
40    }
41}
42
43impl<O: IsA<SimpleProxyResolver>> SimpleProxyResolverExtManual for O {}