rust/library/std/src/net
bors 521734787e Auto merge of #87329 - sunfishcode:sunfishcode/io-safety, r=joshtriplett
I/O safety.

Introduce `OwnedFd` and `BorrowedFd`, and the `AsFd` trait, and
implementations of `AsFd`, `From<OwnedFd>` and `From<T> for OwnedFd`
for relevant types, along with Windows counterparts for handles and
sockets.

Tracking issue: <https://github.com/rust-lang/rust/issues/87074>

RFC: <https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md>

Highlights:
 - The doc comments at the top of library/std/src/os/unix/io/mod.rs and library/std/src/os/windows/io/mod.rs
 - The new types and traits in library/std/src/os/unix/io/fd.rs and library/std/src/os/windows/io/handle.rs
 - The removal of the `RawHandle` struct the Windows impl, which had the same name as the `RawHandle` type alias, and its functionality is now folded into `Handle`.

Managing five levels of wrapping (File wraps sys::fs::File wraps sys::fs::FileDesc wraps OwnedFd wraps RawFd, etc.) made for a fair amount of churn and verbose as/into/from sequences in some places. I've managed to simplify some of them, but I'm open to ideas here.

r? `@joshtriplett`
2021-08-20 11:00:55 +00:00
..
addr Remove redundant 'static from library crates 2020-10-18 17:25:51 +02:00
ip Remove Ipv4Addr::is_ietf_protocol_assignment 2021-06-19 15:03:02 +02:00
parser Disallow octal format in Ipv4 string 2021-03-30 10:24:23 +08:00
tcp Rename ErrorKind::Unknown to Uncategorized. 2021-06-15 14:30:13 +02:00
udp I/O safety. 2021-08-19 12:02:39 -07:00
addr.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
ip.rs Rollup merge of #87708 - the8472:canonical_v6, r=dtolnay 2021-08-03 19:07:48 +09:00
mod.rs Use io::Error::new_const everywhere to avoid allocations. 2021-03-21 20:22:38 +01:00
parser.rs Disallow octal format in Ipv4 string 2021-03-30 10:24:23 +08:00
tcp.rs Auto merge of #87329 - sunfishcode:sunfishcode/io-safety, r=joshtriplett 2021-08-20 11:00:55 +00:00
test.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
udp.rs Add comments about impls for File, TcpStream, ChildStdin, etc. 2021-08-19 12:02:40 -07:00