Skip to content

Commit 0d45141

Browse files
bilelmoussaouisdroege
authored andcommitted
gio/win32: Add missing feature
1 parent 27e19a8 commit 0d45141

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

gio-win32/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ default = []
2929
v2_58 = ["ffi/v2_82", "gio/v2_58"]
3030
v2_60 = ["v2_58", "ffi/v2_60", "gio/v2_60"]
3131
v2_66 = ["v2_60", "ffi/v2_66", "gio/v2_66"]
32-
v2_82 = ["v2_66", "ffi/v2_82", "gio/v2_82"]
32+
v2_78 = ["v2_60", "ffi/v2_78", "gio/v2_78"]
33+
v2_82 = ["v2_78", "ffi/v2_82", "gio/v2_82"]
3334
v2_84 = ["v2_82", "ffi/v2_84", "gio/v2_84"]
3435

3536
[package.metadata.docs.rs]

gio-win32/src/input_stream.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
#[cfg(any(windows, docsrs))]
3+
#[cfg(windows)]
44
use std::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle};
55

66
use glib::{prelude::*, translate::*};
@@ -16,6 +16,8 @@ impl InputStream {
1616
/// with `true` on this stream. At which point you may only do so when all references to this
1717
/// stream have been dropped.
1818
#[doc(alias = "g_win32_input_stream_new")]
19+
#[cfg(windows)]
20+
#[cfg_attr(docsrs, doc(cfg(windows)))]
1921
pub unsafe fn take_handle(handle: impl IntoRawHandle) -> InputStream {
2022
let handle = handle.into_raw_handle();
2123
let close_handle = true.into_glib();
@@ -29,6 +31,8 @@ impl InputStream {
2931
/// # Safety
3032
/// You may only close the handle if all references to this stream have been dropped.
3133
#[doc(alias = "g_win32_input_stream_new")]
34+
#[cfg(windows)]
35+
#[cfg_attr(docsrs, doc(cfg(windows)))]
3236
pub unsafe fn with_handle<T: AsRawHandle>(handle: T) -> InputStream {
3337
let handle = handle.as_raw_handle();
3438
let close_handle = false.into_glib();
@@ -37,6 +41,8 @@ impl InputStream {
3741
}
3842
}
3943

44+
#[cfg(windows)]
45+
#[cfg_attr(docsrs, doc(cfg(windows)))]
4046
impl AsRawHandle for InputStream {
4147
fn as_raw_handle(&self) -> RawHandle {
4248
unsafe { ffi::g_win32_input_stream_get_handle(self.to_glib_none().0) as _ }
@@ -46,6 +52,8 @@ impl AsRawHandle for InputStream {
4652
pub trait InputStreamExtManual: IsA<InputStream> + Sized {
4753
#[doc(alias = "g_win32_input_stream_get_handle")]
4854
#[doc(alias = "get_handle")]
55+
#[cfg(windows)]
56+
#[cfg_attr(docsrs, doc(cfg(windows)))]
4957
fn handle<T: FromRawHandle>(&self) -> T {
5058
unsafe {
5159
T::from_raw_handle(ffi::g_win32_input_stream_get_handle(

gio-win32/src/output_stream.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
#[cfg(any(windows, docsrs))]
3+
#[cfg(windows)]
44
use std::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle};
55

66
use glib::{prelude::*, translate::*};
@@ -16,6 +16,8 @@ impl OutputStream {
1616
/// with `true` on this stream. At which point you may only do so when all references to this
1717
/// stream have been dropped.
1818
#[doc(alias = "g_win32_output_stream_new")]
19+
#[cfg(windows)]
20+
#[cfg_attr(docsrs, doc(cfg(windows)))]
1921
pub unsafe fn take_handle(handle: impl IntoRawHandle) -> OutputStream {
2022
let handle = handle.into_raw_handle();
2123
let close_handle = true.into_glib();
@@ -29,6 +31,8 @@ impl OutputStream {
2931
/// # Safety
3032
/// You may only close the handle if all references to this stream have been dropped.
3133
#[doc(alias = "g_win32_output_stream_new")]
34+
#[cfg(windows)]
35+
#[cfg_attr(docsrs, doc(cfg(windows)))]
3236
pub unsafe fn with_handle<T: AsRawHandle>(handle: T) -> OutputStream {
3337
let handle = handle.as_raw_handle();
3438
let close_handle = false.into_glib();
@@ -37,6 +41,8 @@ impl OutputStream {
3741
}
3842
}
3943

44+
#[cfg(windows)]
45+
#[cfg_attr(docsrs, doc(cfg(windows)))]
4046
impl AsRawHandle for OutputStream {
4147
fn as_raw_handle(&self) -> RawHandle {
4248
unsafe { ffi::g_win32_output_stream_get_handle(self.to_glib_none().0) as _ }
@@ -46,6 +52,8 @@ impl AsRawHandle for OutputStream {
4652
pub trait OutputStreamExtManual: IsA<OutputStream> + Sized {
4753
#[doc(alias = "g_win32_output_stream_get_handle")]
4854
#[doc(alias = "get_handle")]
55+
#[cfg(windows)]
56+
#[cfg_attr(docsrs, doc(cfg(windows)))]
4957
fn handle<T: FromRawHandle>(&self) -> T {
5058
unsafe {
5159
T::from_raw_handle(ffi::g_win32_output_stream_get_handle(

0 commit comments

Comments
 (0)