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
22pub trait SimpleProxyResolverExtManual: IsA<SimpleProxyResolver> + 'static {
23    #[doc(alias = "g_simple_proxy_resolver_set_ignore_hosts")]
24    fn set_ignore_hosts(&self, ignore_hosts: impl IntoStrV) {
25        unsafe {
26            ignore_hosts.run_with_strv(|ignore_hosts| {
27                ffi::g_simple_proxy_resolver_set_ignore_hosts(
28                    self.as_ref().to_glib_none().0,
29                    ignore_hosts.as_ptr() as *mut _,
30                );
31            })
32        }
33    }
34}
35
36impl<O: IsA<SimpleProxyResolver>> SimpleProxyResolverExtManual for O {}