rust/library/std/src/os
bors b31f9cc22b Auto merge of #97178 - sunfishcode:ownedfd-and-dup, r=joshtriplett
Add a `BorrowedFd::try_clone_to_owned` and accompanying documentation

Add a `BorrowedFd::try_clone_to_owned`, which returns a new `OwnedFd` sharing the underlying file description. And similar for `BorrowedHandle` and `BorrowedSocket` on WIndows.

This is similar to the existing `OwnedFd::try_clone`, but it's named differently to reflect that it doesn't return `Result<Self, ...>`. I'm open to suggestions for better names.

Also, extend the `unix::io` documentation to mention that `dup` is permitted on `BorrowedFd`.

This was originally requsted [here](https://github.com/rust-lang/rust/issues/88564#issuecomment-910786081). At the time I wasn't sure whether it was desirable, but it does have uses and it helps clarify the API. The documentation previously didn't rule out using `dup` on a `BorrowedFd`, but the API only offered convenient ways to do it from an `OwnedFd`. With this patch, the API allows one to do `try_clone` on any type where it's permitted.
2022-06-15 21:08:08 +00:00
..
android Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
dragonfly Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
emscripten Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
espidf Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
fd Revise the documentation for try_clone. 2022-06-15 08:55:11 -07:00
fortanix_sgx Stabilize asm! and global_asm! 2021-12-12 11:20:03 +00:00
freebsd Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
fuchsia Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
haiku Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
hermit Move OsStringExt and OsStrExt to std::os 2021-06-20 11:55:01 +02:00
horizon Update libc::stat field names 2022-06-13 20:44:58 -07:00
illumos Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
ios Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
l4re Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
linux Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errors 2022-05-09 04:47:30 +00:00
macos Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
netbsd Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
openbsd Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
raw Provide C FFI types via core::ffi, not just in std 2022-03-01 17:16:05 -08:00
redox Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
solaris Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
solid Add SOLID targets 2021-09-28 11:31:47 +09:00
unix Auto merge of #97178 - sunfishcode:ownedfd-and-dup, r=joshtriplett 2022-06-15 21:08:08 +00:00
vxworks Take sys/vxworks/{fd,fs,io} from sys/unix instead. 2020-10-16 06:19:00 +02:00
wasi Hide Repr details from io::Error, and rework io::Error::new_const. 2022-02-04 18:47:29 -08:00
windows Add the new stability attributes, for Windows. 2022-06-15 09:46:56 -07:00
mod.rs Horizon OS STD support 2022-06-13 20:44:39 -07:00