diff --git a/gio/src/unix_input_stream.rs b/gio/src/unix_input_stream.rs index 2c122893f1be..adedbd9ae8c7 100644 --- a/gio/src/unix_input_stream.rs +++ b/gio/src/unix_input_stream.rs @@ -13,25 +13,13 @@ impl UnixInputStream { // rustdoc-stripper-ignore-next /// Creates a new [`Self`] that takes ownership of the passed in fd. #[doc(alias = "g_unix_input_stream_new")] - pub fn take_fd(fd: OwnedFd) -> UnixInputStream { + pub fn from_fd(fd: OwnedFd) -> UnixInputStream { let fd = fd.into_raw_fd(); let close_fd = true.into_glib(); unsafe { InputStream::from_glib_full(ffi::g_unix_input_stream_new(fd, close_fd)).unsafe_cast() } } - - // rustdoc-stripper-ignore-next - /// Creates a new [`Self`] that does not take ownership of the passed in fd. - /// - /// # Safety - /// You may only close the fd if all references to this stream have been dropped. - #[doc(alias = "g_unix_input_stream_new")] - pub unsafe fn with_fd(fd: T) -> UnixInputStream { - let fd = fd.as_raw_fd(); - let close_fd = false.into_glib(); - InputStream::from_glib_full(ffi::g_unix_input_stream_new(fd, close_fd)).unsafe_cast() - } } impl AsRawFd for UnixInputStream { diff --git a/gio/src/unix_output_stream.rs b/gio/src/unix_output_stream.rs index f8b3692b3370..1343c2fb2fa8 100644 --- a/gio/src/unix_output_stream.rs +++ b/gio/src/unix_output_stream.rs @@ -13,25 +13,13 @@ impl UnixOutputStream { // rustdoc-stripper-ignore-next /// Creates a new [`Self`] that takes ownership of the passed in fd. #[doc(alias = "g_unix_output_stream_new")] - pub fn take_fd(fd: OwnedFd) -> UnixOutputStream { + pub fn from_fd(fd: OwnedFd) -> UnixOutputStream { let fd = fd.into_raw_fd(); let close_fd = true.into_glib(); unsafe { OutputStream::from_glib_full(ffi::g_unix_output_stream_new(fd, close_fd)).unsafe_cast() } } - - // rustdoc-stripper-ignore-next - /// Creates a new [`Self`] that does not take ownership of the passed in fd. - /// - /// # Safety - /// You may only close the fd if all references to this stream have been dropped. - #[doc(alias = "g_unix_output_stream_new")] - pub unsafe fn with_fd(fd: T) -> UnixOutputStream { - let fd = fd.as_raw_fd(); - let close_fd = false.into_glib(); - OutputStream::from_glib_full(ffi::g_unix_output_stream_new(fd, close_fd)).unsafe_cast() - } } impl AsRawFd for UnixOutputStream {