Skip to content

Commit bf6f65d

Browse files
committed
unix_streams: Rename and remove unsafe version
1 parent 578ed66 commit bf6f65d

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

gio/src/unix_input_stream.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,13 @@ impl UnixInputStream {
1313
// rustdoc-stripper-ignore-next
1414
/// Creates a new [`Self`] that takes ownership of the passed in fd.
1515
#[doc(alias = "g_unix_input_stream_new")]
16-
pub fn take_fd(fd: OwnedFd) -> UnixInputStream {
16+
pub fn from_fd(fd: OwnedFd) -> UnixInputStream {
1717
let fd = fd.into_raw_fd();
1818
let close_fd = true.into_glib();
1919
unsafe {
2020
InputStream::from_glib_full(ffi::g_unix_input_stream_new(fd, close_fd)).unsafe_cast()
2121
}
2222
}
23-
24-
// rustdoc-stripper-ignore-next
25-
/// Creates a new [`Self`] that does not take ownership of the passed in fd.
26-
///
27-
/// # Safety
28-
/// You may only close the fd if all references to this stream have been dropped.
29-
#[doc(alias = "g_unix_input_stream_new")]
30-
pub unsafe fn with_fd<T: AsRawFd>(fd: T) -> UnixInputStream {
31-
let fd = fd.as_raw_fd();
32-
let close_fd = false.into_glib();
33-
InputStream::from_glib_full(ffi::g_unix_input_stream_new(fd, close_fd)).unsafe_cast()
34-
}
3523
}
3624

3725
impl AsRawFd for UnixInputStream {

gio/src/unix_output_stream.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,13 @@ impl UnixOutputStream {
1313
// rustdoc-stripper-ignore-next
1414
/// Creates a new [`Self`] that takes ownership of the passed in fd.
1515
#[doc(alias = "g_unix_output_stream_new")]
16-
pub fn take_fd(fd: OwnedFd) -> UnixOutputStream {
16+
pub fn from_fd(fd: OwnedFd) -> UnixOutputStream {
1717
let fd = fd.into_raw_fd();
1818
let close_fd = true.into_glib();
1919
unsafe {
2020
OutputStream::from_glib_full(ffi::g_unix_output_stream_new(fd, close_fd)).unsafe_cast()
2121
}
2222
}
23-
24-
// rustdoc-stripper-ignore-next
25-
/// Creates a new [`Self`] that does not take ownership of the passed in fd.
26-
///
27-
/// # Safety
28-
/// You may only close the fd if all references to this stream have been dropped.
29-
#[doc(alias = "g_unix_output_stream_new")]
30-
pub unsafe fn with_fd<T: AsRawFd>(fd: T) -> UnixOutputStream {
31-
let fd = fd.as_raw_fd();
32-
let close_fd = false.into_glib();
33-
OutputStream::from_glib_full(ffi::g_unix_output_stream_new(fd, close_fd)).unsafe_cast()
34-
}
3523
}
3624

3725
impl AsRawFd for UnixOutputStream {

0 commit comments

Comments
 (0)