summaryrefslogtreecommitdiffstats
path: root/vendor/io-lifetimes/src/impls_std_views.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/io-lifetimes/src/impls_std_views.rs')
-rw-r--r--vendor/io-lifetimes/src/impls_std_views.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/io-lifetimes/src/impls_std_views.rs b/vendor/io-lifetimes/src/impls_std_views.rs
new file mode 100644
index 000000000..ffa013ffa
--- /dev/null
+++ b/vendor/io-lifetimes/src/impls_std_views.rs
@@ -0,0 +1,31 @@
+use crate::views::{FilelikeViewType, SocketlikeViewType};
+#[cfg(any(unix, target_os = "wasi"))]
+use crate::OwnedFd;
+#[cfg(windows)]
+use crate::{OwnedHandle, OwnedSocket};
+
+#[cfg(any(unix, target_os = "wasi"))]
+unsafe impl FilelikeViewType for OwnedFd {}
+
+#[cfg(windows)]
+unsafe impl FilelikeViewType for OwnedHandle {}
+
+#[cfg(windows)]
+unsafe impl SocketlikeViewType for OwnedSocket {}
+
+unsafe impl FilelikeViewType for std::fs::File {}
+
+unsafe impl SocketlikeViewType for std::net::TcpStream {}
+
+unsafe impl SocketlikeViewType for std::net::TcpListener {}
+
+unsafe impl SocketlikeViewType for std::net::UdpSocket {}
+
+#[cfg(unix)]
+unsafe impl SocketlikeViewType for std::os::unix::net::UnixStream {}
+
+#[cfg(unix)]
+unsafe impl SocketlikeViewType for std::os::unix::net::UnixListener {}
+
+#[cfg(unix)]
+unsafe impl SocketlikeViewType for std::os::unix::net::UnixDatagram {}