Skip to content

Commit 0a0d316

Browse files
authored
Merge pull request #1429 from sdroege/gio-win32-streams-traits
gio: Properly export Win32InputStream / Win32OutputStream traits
2 parents 7cd0642 + 388f2a6 commit 0a0d316

File tree

6 files changed

+38
-41
lines changed

6 files changed

+38
-41
lines changed

gio/Gir.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,10 +1653,10 @@ status = "generate"
16531653
name = "Gio.Win32InputStream"
16541654
status = "manual"
16551655
cfg_condition = "windows"
1656-
manual_traits = ["Win32InputStreamExtManual"]
1656+
manual_traits = ["Win32InputStreamExt"]
16571657

16581658
[[object]]
16591659
name = "Gio.Win32OutputStream"
16601660
status = "manual"
16611661
cfg_condition = "windows"
1662-
manual_traits = ["Win32OutputStreamExtManual"]
1662+
manual_traits = ["Win32OutputStreamExt"]

gio/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ pub use crate::write_output_stream::WriteOutputStream;
145145
mod dbus_proxy;
146146
mod tls_connection;
147147

148-
#[cfg(target_family = "windows")]
148+
#[cfg(windows)]
149149
mod win32_input_stream;
150-
#[cfg(target_family = "windows")]
150+
#[cfg(windows)]
151151
pub use self::win32_input_stream::Win32InputStream;
152152

153-
#[cfg(target_family = "windows")]
153+
#[cfg(windows)]
154154
mod win32_output_stream;
155-
#[cfg(target_family = "windows")]
155+
#[cfg(windows)]
156156
pub use self::win32_output_stream::Win32OutputStream;

gio/src/prelude.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ pub use crate::unix_input_stream::UnixInputStreamExtManual;
2727
pub use crate::unix_output_stream::UnixOutputStreamExtManual;
2828
#[cfg(unix)]
2929
pub use crate::unix_socket_address::{UnixSocketAddressExtManual, UnixSocketAddressPath};
30+
#[cfg(windows)]
31+
pub use crate::win32_input_stream::Win32InputStreamExt;
32+
#[cfg(windows)]
33+
pub use crate::win32_output_stream::Win32OutputStreamExt;
3034
pub use crate::{
3135
action_map::ActionMapExtManual, application::ApplicationExtManual, auto::traits::*,
3236
cancellable::CancellableExtManual, converter::ConverterExtManual,

gio/src/subprocess_launcher.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ use std::os::unix::io::IntoRawFd;
66
#[cfg(unix)]
77
use glib::translate::*;
88

9-
use crate::{ffi, SubprocessLauncher};
9+
#[cfg(unix)]
10+
use crate::ffi;
11+
12+
use crate::SubprocessLauncher;
1013

1114
#[cfg(all(docsrs, not(unix)))]
1215
pub trait IntoRawFd: Sized {

gio/src/win32_input_stream.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,6 @@ glib::wrapper! {
1414
}
1515
}
1616

17-
pub trait Win32InputStreamExt: 'static {
18-
#[doc(alias = "g_win32_input_stream_get_close_handle")]
19-
#[doc(alias = "get_close_handle")]
20-
fn closes_handle(&self) -> bool;
21-
}
22-
23-
impl<O: IsA<Win32InputStream>> Win32InputStreamExt for O {
24-
fn closes_handle(&self) -> bool {
25-
unsafe {
26-
from_glib(ffi::g_win32_input_stream_get_close_handle(
27-
self.as_ref().to_glib_none().0,
28-
))
29-
}
30-
}
31-
}
32-
3317
impl Win32InputStream {
3418
pub const NONE: Option<&'static Win32InputStream> = None;
3519

@@ -73,7 +57,17 @@ mod sealed {
7357
impl<T: super::IsA<super::Win32InputStream>> Sealed for T {}
7458
}
7559

76-
pub trait Win32InputStreamExtManual: sealed::Sealed + IsA<Win32InputStream> + Sized {
60+
pub trait Win32InputStreamExt: sealed::Sealed + IsA<Win32InputStream> + Sized {
61+
#[doc(alias = "g_win32_input_stream_get_close_handle")]
62+
#[doc(alias = "get_close_handle")]
63+
fn closes_handle(&self) -> bool {
64+
unsafe {
65+
from_glib(ffi::g_win32_input_stream_get_close_handle(
66+
self.as_ref().to_glib_none().0,
67+
))
68+
}
69+
}
70+
7771
#[doc(alias = "g_win32_input_stream_get_handle")]
7872
#[doc(alias = "get_handle")]
7973
fn handle<T: FromRawHandle>(&self) -> T {
@@ -99,4 +93,4 @@ pub trait Win32InputStreamExtManual: sealed::Sealed + IsA<Win32InputStream> + Si
9993
}
10094
}
10195

102-
impl<O: IsA<Win32InputStream>> Win32InputStreamExtManual for O {}
96+
impl<O: IsA<Win32InputStream>> Win32InputStreamExt for O {}

gio/src/win32_output_stream.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,6 @@ glib::wrapper! {
1414
}
1515
}
1616

17-
pub trait Win32OutputStreamExt: IsA<Win32OutputStream> + 'static {
18-
#[doc(alias = "g_win32_output_stream_get_close_handle")]
19-
#[doc(alias = "get_close_handle")]
20-
fn closes_handle(&self) -> bool {
21-
unsafe {
22-
from_glib(ffi::g_win32_output_stream_get_close_handle(
23-
self.as_ref().to_glib_none().0,
24-
))
25-
}
26-
}
27-
}
28-
29-
impl<O: IsA<Win32OutputStream>> Win32OutputStreamExt for O {}
30-
3117
impl Win32OutputStream {
3218
pub const NONE: Option<&'static Win32OutputStream> = None;
3319

@@ -71,7 +57,17 @@ mod sealed {
7157
impl<T: super::IsA<super::Win32OutputStream>> Sealed for T {}
7258
}
7359

74-
pub trait Win32OutputStreamExtManual: sealed::Sealed + IsA<Win32OutputStream> + Sized {
60+
pub trait Win32OutputStreamExt: sealed::Sealed + IsA<Win32OutputStream> + Sized {
61+
#[doc(alias = "g_win32_output_stream_get_close_handle")]
62+
#[doc(alias = "get_close_handle")]
63+
fn closes_handle(&self) -> bool {
64+
unsafe {
65+
from_glib(ffi::g_win32_output_stream_get_close_handle(
66+
self.as_ref().to_glib_none().0,
67+
))
68+
}
69+
}
70+
7571
#[doc(alias = "g_win32_output_stream_get_handle")]
7672
#[doc(alias = "get_handle")]
7773
fn handle<T: FromRawHandle>(&self) -> T {
@@ -97,4 +93,4 @@ pub trait Win32OutputStreamExtManual: sealed::Sealed + IsA<Win32OutputStream> +
9793
}
9894
}
9995

100-
impl<O: IsA<Win32OutputStream>> Win32OutputStreamExtManual for O {}
96+
impl<O: IsA<Win32OutputStream>> Win32OutputStreamExt for O {}

0 commit comments

Comments
 (0)