Skip to content

Commit 063c4d4

Browse files
committed
gio: use StrV for the simple proxy resolver API
1 parent 2e2af7c commit 063c4d4

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

gio/src/simple_proxy_resolver.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
use glib::{prelude::*, translate::*};
3+
use glib::{prelude::*, translate::*, IntoStrV};
44

55
use crate::{ProxyResolver, SimpleProxyResolver};
66

77
impl SimpleProxyResolver {
88
#[doc(alias = "g_simple_proxy_resolver_new")]
99
#[allow(clippy::new_ret_no_self)]
10-
pub fn new(default_proxy: Option<&str>, ignore_hosts: &[&str]) -> ProxyResolver {
10+
pub fn new(default_proxy: Option<&str>, ignore_hosts: impl IntoStrV) -> ProxyResolver {
1111
unsafe {
12-
from_glib_full(ffi::g_simple_proxy_resolver_new(
13-
default_proxy.to_glib_none().0,
14-
ignore_hosts.to_glib_none().0,
15-
))
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+
})
1618
}
1719
}
1820
}
1921

2022
pub trait SimpleProxyResolverExtManual: 'static {
2123
#[doc(alias = "g_simple_proxy_resolver_set_ignore_hosts")]
22-
fn set_ignore_hosts(&self, ignore_hosts: &[&str]);
24+
fn set_ignore_hosts(&self, ignore_hosts: impl IntoStrV);
2325
}
2426

2527
impl<O: IsA<SimpleProxyResolver>> SimpleProxyResolverExtManual for O {
26-
fn set_ignore_hosts(&self, ignore_hosts: &[&str]) {
28+
fn set_ignore_hosts(&self, ignore_hosts: impl IntoStrV) {
2729
unsafe {
28-
ffi::g_simple_proxy_resolver_set_ignore_hosts(
29-
self.as_ref().to_glib_none().0,
30-
ignore_hosts.to_glib_none().0,
31-
);
30+
ignore_hosts.run_with_strv(|ignore_hosts| {
31+
ffi::g_simple_proxy_resolver_set_ignore_hosts(
32+
self.as_ref().to_glib_none().0,
33+
ignore_hosts.as_ptr() as *mut _,
34+
);
35+
})
3236
}
3337
}
3438
}

0 commit comments

Comments
 (0)