From f8943350ab9246d83fbee2ce3e3e114778b3d871 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sat, 15 Feb 2025 12:29:47 -0800 Subject: [PATCH] Improve documentation generation Make `x86_64-unknown-linux-gnu` the default target, as it's more feature rich. Users may not realize that they can select their platform on docs.rs, so it's better to show them more extensive documentation. Don't pass `--cfg docsrs` to rustdoc for docs.rs builds, it's already passed by docs.rs. Generate documentation about supported platforms automatically from the `cfg` attributes. --- Cargo.toml | 19 ++- src/lib.rs | 50 +----- src/socket.rs | 110 ------------- src/sockref.rs | 2 - src/sys/unix.rs | 400 --------------------------------------------- src/sys/windows.rs | 8 - 6 files changed, 19 insertions(+), 570 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c8656f05..18331f61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,8 +29,23 @@ include = [ [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docsrs"] -targets = ["aarch64-apple-ios", "aarch64-linux-android", "x86_64-apple-darwin", "x86_64-unknown-fuchsia", "x86_64-pc-windows-msvc", "x86_64-pc-solaris", "x86_64-unknown-freebsd", "x86_64-unknown-illumos", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-unknown-netbsd", "x86_64-unknown-redox", "armv7-linux-androideabi", "i686-linux-android"] +default-target = "x86_64-unknown-linux-gnu" +targets = [ + "aarch64-apple-ios", + "aarch64-linux-android", + "armv7-linux-androideabi", + "i686-linux-android", + "x86_64-apple-darwin", + "x86_64-pc-solaris", + "x86_64-pc-windows-msvc", + "x86_64-unknown-freebsd", + "x86_64-unknown-fuchsia", + "x86_64-unknown-illumos", + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", + "x86_64-unknown-netbsd", + "x86_64-unknown-redox", +] [package.metadata.playground] features = ["all"] diff --git a/src/lib.rs b/src/lib.rs index 8f593163..946714ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,8 +51,8 @@ //! that are not available on all OSs. #![deny(missing_docs, missing_debug_implementations, rust_2018_idioms)] -// Show required OS/features on docs.rs. -#![cfg_attr(docsrs, feature(doc_cfg))] +// Automatically generate required OS/features for docs.rs. +#![cfg_attr(docsrs, feature(doc_auto_cfg))] // Disallow warnings when running tests. #![cfg_attr(test, deny(warnings))] // Disallow warnings in examples. @@ -266,20 +266,14 @@ impl Type { /// /// Used for the DCCP protocol. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub const DCCP: Type = Type(sys::SOCK_DCCP); /// Type corresponding to `SOCK_SEQPACKET`. #[cfg(all(feature = "all", not(target_os = "espidf")))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", not(target_os = "espidf")))))] pub const SEQPACKET: Type = Type(sys::SOCK_SEQPACKET); /// Type corresponding to `SOCK_RAW`. #[cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))) - )] pub const RAW: Type = Type(sys::SOCK_RAW); } @@ -324,7 +318,6 @@ impl Protocol { /// Protocol corresponding to `DCCP`. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub const DCCP: Protocol = Protocol(sys::IPPROTO_DCCP); /// Protocol corresponding to `SCTP`. @@ -364,7 +357,6 @@ impl From for c_int { /// /// Flags provide additional information about incoming messages. #[cfg(not(target_os = "redox"))] -#[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] #[derive(Copy, Clone, Eq, PartialEq)] pub struct RecvFlags(c_int); @@ -523,24 +515,6 @@ impl TcpKeepalive { target_os = "watchos", target_os = "windows", ))] - #[cfg_attr( - docsrs, - doc(cfg(any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "illumos", - target_os = "ios", - target_os = "visionos", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "tvos", - target_os = "watchos", - target_os = "windows", - ))) - )] pub const fn with_interval(self, interval: Duration) -> Self { Self { interval: Some(interval), @@ -569,26 +543,6 @@ impl TcpKeepalive { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "illumos", - target_os = "ios", - target_os = "visionos", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub const fn with_retries(self, retries: u32) -> Self { Self { retries: Some(retries), diff --git a/src/socket.rs b/src/socket.rs index e6cdca24..1bed96f5 100644 --- a/src/socket.rs +++ b/src/socket.rs @@ -150,7 +150,6 @@ impl Socket { /// [`Socket::pair_raw`] can be used if you don't want to set those flags. #[doc = man_links!(unix: socketpair(2))] #[cfg(all(feature = "all", unix))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", unix))))] pub fn pair( domain: Domain, ty: Type, @@ -167,7 +166,6 @@ impl Socket { /// /// This function corresponds to `socketpair(2)`. #[cfg(all(feature = "all", unix))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", unix))))] pub fn pair_raw( domain: Domain, ty: Type, @@ -369,7 +367,6 @@ impl Socket { /// /// On Windows it is not possible retrieve the nonblocking mode status. #[cfg(all(feature = "all", unix))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", unix))))] pub fn nonblocking(&self) -> io::Result { sys::nonblocking(self.as_raw()) } @@ -471,7 +468,6 @@ impl Socket { /// function with `buf`s of type `&mut [IoSliceMut]`, allowing initialised /// buffers to be used without using `unsafe`. #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn recv_vectored( &self, bufs: &mut [MaybeUninitSlice<'_>], @@ -491,7 +487,6 @@ impl Socket { /// /// [`recv_vectored`]: Socket::recv_vectored #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn recv_vectored_with_flags( &self, bufs: &mut [MaybeUninitSlice<'_>], @@ -557,7 +552,6 @@ impl Socket { /// /// [`recv_vectored`]: Socket::recv_vectored #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn recv_from_vectored( &self, bufs: &mut [MaybeUninitSlice<'_>], @@ -577,7 +571,6 @@ impl Socket { /// /// [`recv_vectored`]: Socket::recv_vectored #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn recv_from_vectored_with_flags( &self, bufs: &mut [MaybeUninitSlice<'_>], @@ -637,7 +630,6 @@ impl Socket { /// for an example (in C++). #[doc = man_links!(recvmsg(2))] #[cfg(all(unix, not(target_os = "redox")))] - #[cfg_attr(docsrs, doc(cfg(all(unix, not(target_os = "redox")))))] pub fn recvmsg(&self, msg: &mut MsgHdrMut<'_, '_, '_>, flags: sys::c_int) -> io::Result { sys::recvmsg(self.as_raw(), msg, flags) } @@ -663,7 +655,6 @@ impl Socket { /// Send data to the connected peer. Returns the amount of bytes written. #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn send_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result { self.send_vectored_with_flags(bufs, 0) } @@ -674,7 +665,6 @@ impl Socket { /// /// [`send_vectored`]: Socket::send_vectored #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn send_vectored_with_flags( &self, bufs: &[IoSlice<'_>], @@ -721,7 +711,6 @@ impl Socket { /// written. #[doc = man_links!(sendmsg(2))] #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn send_to_vectored(&self, bufs: &[IoSlice<'_>], addr: &SockAddr) -> io::Result { self.send_to_vectored_with_flags(bufs, addr, 0) } @@ -731,7 +720,6 @@ impl Socket { /// /// [`send_to_vectored`]: Socket::send_to_vectored #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn send_to_vectored_with_flags( &self, bufs: &[IoSlice<'_>], @@ -744,7 +732,6 @@ impl Socket { /// Send a message on a socket using a message structure. #[doc = man_links!(sendmsg(2))] #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn sendmsg(&self, msg: &MsgHdr<'_, '_, '_>, flags: sys::c_int) -> io::Result { sys::sendmsg(self.as_raw(), msg, flags) } @@ -939,7 +926,6 @@ impl Socket { /// /// [`set_out_of_band_inline`]: Socket::set_out_of_band_inline #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn out_of_band_inline(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::SOL_SOCKET, sys::SO_OOBINLINE) @@ -954,7 +940,6 @@ impl Socket { /// `MSG_OOB` flag is set during receiving. As per RFC6093, TCP sockets /// using the Urgent mechanism are encouraged to set this flag. #[cfg(not(target_os = "redox"))] - #[cfg_attr(docsrs, doc(cfg(not(target_os = "redox"))))] pub fn set_out_of_band_inline(&self, oob_inline: bool) -> io::Result<()> { unsafe { setsockopt( @@ -972,7 +957,6 @@ impl Socket { /// /// [`set_passcred`]: Socket::set_passcred #[cfg(all(unix, target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(unix, target_os = "linux"))))] pub fn passcred(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::SOL_SOCKET, sys::SO_PASSCRED) @@ -985,7 +969,6 @@ impl Socket { /// If this option is enabled, enables the receiving of the `SCM_CREDENTIALS` /// control messages. #[cfg(all(unix, target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(unix, target_os = "linux"))))] pub fn set_passcred(&self, passcred: bool) -> io::Result<()> { unsafe { setsockopt( @@ -1145,10 +1128,6 @@ impl Socket { /// /// [`set_header_included_v4`]: Socket::set_header_included_v4 #[cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))) - )] pub fn header_included_v4(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::IPPROTO_IP, sys::IP_HDRINCL) @@ -1172,10 +1151,6 @@ impl Socket { allow(rustdoc::broken_intra_doc_links) )] #[cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))) - )] pub fn set_header_included_v4(&self, included: bool) -> io::Result<()> { unsafe { setsockopt( @@ -1193,7 +1168,6 @@ impl Socket { /// /// [`set_ip_transparent_v4`]: Socket::set_ip_transparent_v4 #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn ip_transparent_v4(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::IPPROTO_IP, libc::IP_TRANSPARENT) @@ -1217,7 +1191,6 @@ impl Socket { /// TProxy redirection with the iptables TPROXY target also /// requires that this option be set on the redirected socket. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_ip_transparent_v4(&self, transparent: bool) -> io::Result<()> { unsafe { setsockopt( @@ -1415,7 +1388,6 @@ impl Socket { /// /// [`set_multicast_all_v4`]: Socket::set_multicast_all_v4 #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn multicast_all_v4(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::IPPROTO_IP, libc::IP_MULTICAST_ALL) @@ -1434,7 +1406,6 @@ impl Socket { /// joined (for example via the `IP_ADD_MEMBERSHIP` option) on /// this particular socket. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_multicast_all_v4(&self, all: bool) -> io::Result<()> { unsafe { setsockopt( @@ -1668,10 +1639,6 @@ impl Socket { target_os = "netbsd" )) ))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))) - )] pub fn header_included_v6(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::IPPROTO_IPV6, sys::IP_HDRINCL) @@ -1702,10 +1669,6 @@ impl Socket { target_os = "netbsd" )) ))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))) - )] pub fn set_header_included_v6(&self, included: bool) -> io::Result<()> { unsafe { setsockopt( @@ -1799,7 +1762,6 @@ impl Socket { /// /// [`set_multicast_all_v6`]: Socket::set_multicast_all_v6 #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn multicast_all_v6(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::IPPROTO_IPV6, libc::IPV6_MULTICAST_ALL) @@ -1818,7 +1780,6 @@ impl Socket { /// joined (for example via the `IPV6_ADD_MEMBERSHIP` option) on /// this particular socket. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_multicast_all_v6(&self, all: bool) -> io::Result<()> { unsafe { setsockopt( @@ -2075,18 +2036,6 @@ impl Socket { target_os = "vita" )) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - not(any( - windows, - target_os = "haiku", - target_os = "openbsd", - target_os = "vita" - )) - ))) - )] pub fn keepalive_time(&self) -> io::Result { sys::keepalive_time(self.as_raw()) } @@ -2113,26 +2062,6 @@ impl Socket { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "illumos", - target_os = "ios", - target_os = "visionos", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub fn keepalive_interval(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::IPPROTO_TCP, sys::TCP_KEEPINTVL) @@ -2162,26 +2091,6 @@ impl Socket { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "illumos", - target_os = "ios", - target_os = "visionos", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub fn keepalive_retries(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::IPPROTO_TCP, sys::TCP_KEEPCNT) @@ -2272,18 +2181,6 @@ impl Socket { target_os = "windows", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "fuchsia", - target_os = "linux", - target_os = "windows", - ) - ))) - )] pub fn original_dst(&self) -> io::Result { sys::original_dst(self.as_raw()) } @@ -2293,13 +2190,6 @@ impl Socket { feature = "all", any(target_os = "android", target_os = "linux", target_os = "windows") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "linux", target_os = "windows") - ))) - )] pub fn original_dst_ipv6(&self) -> io::Result { sys::original_dst_ipv6(self.as_raw()) } diff --git a/src/sockref.rs b/src/sockref.rs index 94b84dd4..59353b15 100644 --- a/src/sockref.rs +++ b/src/sockref.rs @@ -78,7 +78,6 @@ impl<'s> Deref for SockRef<'s> { /// On Windows, a corresponding `From<&impl AsSocket>` implementation exists. #[cfg(unix)] -#[cfg_attr(docsrs, doc(cfg(unix)))] impl<'s, S> From<&'s S> for SockRef<'s> where S: AsFd, @@ -96,7 +95,6 @@ where /// On Unix, a corresponding `From<&impl AsFd>` implementation exists. #[cfg(windows)] -#[cfg_attr(docsrs, doc(cfg(windows)))] impl<'s, S> From<&'s S> for SockRef<'s> where S: AsSocket, diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 05cb2e91..c187d517 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -389,21 +389,10 @@ impl Domain { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub const PACKET: Domain = Domain(libc::AF_PACKET); /// Domain for low-level VSOCK interface, corresponding to `AF_VSOCK`. #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) - )] pub const VSOCK: Domain = Domain(libc::AF_VSOCK); } @@ -413,13 +402,8 @@ impl_debug!( libc::AF_INET6, libc::AF_UNIX, #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] - #[cfg_attr( - docsrs, - doc(cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))) - )] libc::AF_PACKET, #[cfg(any(target_os = "android", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(any(target_os = "android", target_os = "linux"))))] libc::AF_VSOCK, libc::AF_UNSPEC, // = 0. ); @@ -440,22 +424,6 @@ impl Type { target_os = "openbsd" ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "illumos", - target_os = "linux", - target_os = "netbsd", - target_os = "openbsd" - ) - ))) - )] pub const fn nonblocking(self) -> Type { Type(self.0 | libc::SOCK_NONBLOCK) } @@ -477,25 +445,6 @@ impl Type { target_os = "solaris", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "hurd", - target_os = "illumos", - target_os = "linux", - target_os = "netbsd", - target_os = "openbsd", - target_os = "redox", - target_os = "solaris", - ) - ))) - )] pub const fn cloexec(self) -> Type { self._cloexec() } @@ -615,10 +564,6 @@ impl RecvFlags { /// /// On Unix this corresponds to the `MSG_CONFIRM` flag. #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) - )] pub const fn is_confirm(self) -> bool { self.0 & libc::MSG_CONFIRM != 0 } @@ -630,10 +575,6 @@ impl RecvFlags { /// /// On Unix this corresponds to the `MSG_DONTROUTE` flag. #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) - )] pub const fn is_dontroute(self) -> bool { self.0 & libc::MSG_DONTROUTE != 0 } @@ -786,10 +727,6 @@ impl SockAddr { /// infallible. #[allow(unsafe_op_in_unsafe_fn)] #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) - )] pub fn vsock(cid: u32, port: u32) -> SockAddr { // SAFETY: a `sockaddr_storage` of all zeros is valid. let mut storage = unsafe { mem::zeroed::() }; @@ -806,10 +743,6 @@ impl SockAddr { /// Returns this address VSOCK CID/port if it is in the `AF_VSOCK` family, /// otherwise return `None`. #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) - )] pub fn as_vsock_address(&self) -> Option<(u32, u32)> { if self.family() == libc::AF_VSOCK as sa_family_t { // Safety: if the ss_family field is AF_VSOCK then storage must be a sockaddr_vm. @@ -934,7 +867,6 @@ pub(crate) fn socket(family: c_int, ty: c_int, protocol: c_int) -> io::Result io::Result<[Socket; 2]> { let mut fds = [0, 0]; syscall!(socketpair(family, ty, protocol, fds.as_mut_ptr())).map(|_| fds) @@ -1229,13 +1161,6 @@ fn into_timeval(duration: Option) -> libc::timeval { feature = "all", not(any(target_os = "haiku", target_os = "openbsd", target_os = "vita")) ))] -#[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - not(any(target_os = "haiku", target_os = "openbsd", target_os = "vita")) - ))) -)] pub(crate) fn keepalive_time(fd: Socket) -> io::Result { unsafe { getsockopt::(fd, IPPROTO_TCP, KEEPALIVE_TIME) @@ -1487,22 +1412,6 @@ impl crate::Socket { target_os = "openbsd", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "illumos", - target_os = "linux", - target_os = "netbsd", - target_os = "openbsd", - ) - ))) - )] pub fn accept4(&self, flags: c_int) -> io::Result<(crate::Socket, SockAddr)> { self._accept4(flags) } @@ -1543,7 +1452,6 @@ impl crate::Socket { allow(rustdoc::broken_intra_doc_links) )] #[cfg(all(feature = "all", not(target_os = "vita")))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", unix))))] pub fn set_cloexec(&self, close_on_exec: bool) -> io::Result<()> { self._set_cloexec(close_on_exec) } @@ -1578,19 +1486,6 @@ impl crate::Socket { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "ios", - target_os = "visionos", - target_os = "macos", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub fn set_nosigpipe(&self, nosigpipe: bool) -> io::Result<()> { self._set_nosigpipe(nosigpipe) } @@ -1619,7 +1514,6 @@ impl crate::Socket { /// /// [`set_mss`]: crate::Socket::set_mss #[cfg(all(feature = "all", not(target_os = "redox")))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", unix, not(target_os = "redox")))))] pub fn mss(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::IPPROTO_TCP, libc::TCP_MAXSEG) @@ -1632,7 +1526,6 @@ impl crate::Socket { /// The `TCP_MAXSEG` option denotes the TCP Maximum Segment Size and is only /// available on TCP sockets. #[cfg(all(feature = "all", not(target_os = "redox")))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", unix, not(target_os = "redox")))))] pub fn set_mss(&self, mss: u32) -> io::Result<()> { unsafe { setsockopt( @@ -1656,19 +1549,6 @@ impl crate::Socket { target_os = "linux", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "aix", - target_os = "android", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "linux", - ) - ))) - )] pub fn is_listener(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::SOL_SOCKET, libc::SO_ACCEPTCONN) @@ -1688,16 +1568,6 @@ impl crate::Socket { target_os = "linux", ) ))] - #[cfg_attr(docsrs, doc(cfg(all( - feature = "all", - any( - target_os = "android", - // TODO: add FreeBSD. - // target_os = "freebsd", - target_os = "fuchsia", - target_os = "linux", - ) - ))))] pub fn domain(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::SOL_SOCKET, libc::SO_DOMAIN).map(Domain) } } @@ -1713,18 +1583,6 @@ impl crate::Socket { target_os = "linux", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "linux", - ) - ))) - )] pub fn protocol(&self) -> io::Result> { unsafe { getsockopt::(self.as_raw(), libc::SOL_SOCKET, libc::SO_PROTOCOL).map(|v| match v @@ -1745,13 +1603,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn mark(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::SOL_SOCKET, libc::SO_MARK) @@ -1770,13 +1621,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn set_mark(&self, mark: u32) -> io::Result<()> { unsafe { setsockopt::( @@ -1797,13 +1641,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn cork(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::IPPROTO_TCP, libc::TCP_CORK) @@ -1821,13 +1658,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn set_cork(&self, cork: bool) -> io::Result<()> { unsafe { setsockopt( @@ -1848,13 +1678,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn quickack(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::IPPROTO_TCP, libc::TCP_QUICKACK) @@ -1872,13 +1695,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn set_quickack(&self, quickack: bool) -> io::Result<()> { unsafe { setsockopt( @@ -1899,13 +1715,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn thin_linear_timeouts(&self) -> io::Result { unsafe { getsockopt::( @@ -1926,13 +1735,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn set_thin_linear_timeouts(&self, timeouts: bool) -> io::Result<()> { unsafe { setsockopt( @@ -1951,13 +1753,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn device(&self) -> io::Result>> { // TODO: replace with `MaybeUninit::uninit_array` once stable. let mut buf: [MaybeUninit; libc::IFNAMSIZ] = @@ -1990,13 +1785,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn bind_device(&self, interface: Option<&[u8]>) -> io::Result<()> { let (value, len) = if let Some(interface) = interface { (interface.as_ptr(), interface.len()) @@ -2017,7 +1805,6 @@ impl crate::Socket { /// /// Bind socket to the specified forwarding table (VRF) on a FreeBSD. #[cfg(all(feature = "all", target_os = "freebsd"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "freebsd"))))] pub fn set_fib(&self, fib: u32) -> io::Result<()> { syscall!(setsockopt( self.as_raw(), @@ -2049,19 +1836,6 @@ impl crate::Socket { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "ios", - target_os = "visionos", - target_os = "macos", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub fn bind_device_by_index_v4(&self, interface: Option) -> io::Result<()> { let index = interface.map_or(0, NonZeroU32::get); unsafe { setsockopt(self.as_raw(), IPPROTO_IP, libc::IP_BOUND_IF, index) } @@ -2087,19 +1861,6 @@ impl crate::Socket { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "ios", - target_os = "visionos", - target_os = "macos", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub fn bind_device_by_index_v6(&self, interface: Option) -> io::Result<()> { let index = interface.map_or(0, NonZeroU32::get); unsafe { setsockopt(self.as_raw(), IPPROTO_IPV6, libc::IPV6_BOUND_IF, index) } @@ -2120,19 +1881,6 @@ impl crate::Socket { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "ios", - target_os = "visionos", - target_os = "macos", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub fn device_index_v4(&self) -> io::Result> { let index = unsafe { getsockopt::(self.as_raw(), IPPROTO_IP, libc::IP_BOUND_IF)? }; @@ -2154,19 +1902,6 @@ impl crate::Socket { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "ios", - target_os = "visionos", - target_os = "macos", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub fn device_index_v6(&self) -> io::Result> { let index = unsafe { getsockopt::(self.as_raw(), IPPROTO_IPV6, libc::IPV6_BOUND_IF)? @@ -2180,7 +1915,6 @@ impl crate::Socket { /// /// [`set_cpu_affinity`]: crate::Socket::set_cpu_affinity #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn cpu_affinity(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::SOL_SOCKET, libc::SO_INCOMING_CPU) @@ -2192,7 +1926,6 @@ impl crate::Socket { /// /// Sets the CPU affinity of the socket. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_cpu_affinity(&self, cpu: usize) -> io::Result<()> { unsafe { setsockopt( @@ -2213,14 +1946,6 @@ impl crate::Socket { feature = "all", not(any(target_os = "solaris", target_os = "illumos")) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - unix, - not(any(target_os = "solaris", target_os = "illumos")) - ))) - )] pub fn reuse_port(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::SOL_SOCKET, libc::SO_REUSEPORT) @@ -2237,14 +1962,6 @@ impl crate::Socket { feature = "all", not(any(target_os = "solaris", target_os = "illumos")) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - unix, - not(any(target_os = "solaris", target_os = "illumos")) - ))) - )] pub fn set_reuse_port(&self, reuse: bool) -> io::Result<()> { unsafe { setsockopt( @@ -2294,13 +2011,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn freebind(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::SOL_IP, libc::IP_FREEBIND) @@ -2319,13 +2029,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn set_freebind(&self, freebind: bool) -> io::Result<()> { unsafe { setsockopt( @@ -2345,10 +2048,6 @@ impl crate::Socket { /// /// [`set_freebind`]: crate::Socket::set_freebind #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) - )] pub fn freebind_ipv6(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::SOL_IPV6, libc::IPV6_FREEBIND) @@ -2387,10 +2086,6 @@ impl crate::Socket { /// # } /// ``` #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) - )] pub fn set_freebind_ipv6(&self, freebind: bool) -> io::Result<()> { unsafe { setsockopt( @@ -2435,23 +2130,6 @@ impl crate::Socket { target_os = "watchos", ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "aix", - target_os = "android", - target_os = "freebsd", - target_os = "ios", - target_os = "visionos", - target_os = "linux", - target_os = "macos", - target_os = "tvos", - target_os = "watchos", - ) - ))) - )] pub fn sendfile( &self, file: &F, @@ -2584,13 +2262,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn set_tcp_user_timeout(&self, timeout: Option) -> io::Result<()> { let timeout = timeout.map_or(0, |to| { min(to.as_millis(), libc::c_uint::MAX as u128) as libc::c_uint @@ -2614,13 +2285,6 @@ impl crate::Socket { feature = "all", any(target_os = "android", target_os = "fuchsia", target_os = "linux") ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any(target_os = "android", target_os = "fuchsia", target_os = "linux") - ))) - )] pub fn tcp_user_timeout(&self) -> io::Result> { unsafe { getsockopt::(self.as_raw(), libc::IPPROTO_TCP, libc::TCP_USER_TIMEOUT) @@ -2674,7 +2338,6 @@ impl crate::Socket { /// /// For more information about this option, see [Linux patch](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5daab9db7b65df87da26fd8cfa695fb9546a1ddb) #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn cookie(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), libc::SOL_SOCKET, libc::SO_COOKIE) } } @@ -2697,22 +2360,6 @@ impl crate::Socket { target_os = "openbsd" ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "openbsd" - ) - ))) - )] pub fn tclass_v6(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), IPPROTO_IPV6, libc::IPV6_TCLASS) @@ -2737,22 +2384,6 @@ impl crate::Socket { target_os = "openbsd" ) ))] - #[cfg_attr( - docsrs, - doc(cfg(all( - feature = "all", - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "openbsd" - ) - ))) - )] pub fn set_tclass_v6(&self, tclass: u32) -> io::Result<()> { unsafe { setsockopt( @@ -2770,10 +2401,6 @@ impl crate::Socket { /// /// [`set_tcp_congestion`]: crate::Socket::set_tcp_congestion #[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))) - )] pub fn tcp_congestion(&self) -> io::Result> { let mut payload: [u8; TCP_CA_NAME_MAX] = [0; TCP_CA_NAME_MAX]; let mut len = payload.len() as libc::socklen_t; @@ -2794,10 +2421,6 @@ impl crate::Socket { /// The value must be a valid TCP congestion control algorithm name of the /// platform. For example, Linux may supports "reno", "cubic". #[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))) - )] pub fn set_tcp_congestion(&self, tcp_ca_name: &[u8]) -> io::Result<()> { syscall!(setsockopt( self.as_raw(), @@ -2820,7 +2443,6 @@ impl crate::Socket { /// [`connect`]: crate::Socket::connect /// [`bind`]: crate::Socket::bind #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_dccp_service(&self, code: u32) -> io::Result<()> { unsafe { setsockopt( @@ -2838,7 +2460,6 @@ impl crate::Socket { /// /// [`set_dccp_service`]: crate::Socket::set_dccp_service #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_service(&self) -> io::Result { unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_SERVICE) } } @@ -2847,7 +2468,6 @@ impl crate::Socket { /// /// This option sets both the TX and RX CCIDs at the same time. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_dccp_ccid(&self, ccid: u8) -> io::Result<()> { unsafe { setsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_CCID, ccid) } } @@ -2858,7 +2478,6 @@ impl crate::Socket { /// /// [`set_dccp_ccid`]: crate::Socket::set_dccp_ccid #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_tx_ccid(&self) -> io::Result { unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_TX_CCID) } } @@ -2869,7 +2488,6 @@ impl crate::Socket { /// /// [`set_dccp_ccid`]: crate::Socket::set_dccp_ccid #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_xx_ccid(&self) -> io::Result { unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_RX_CCID) } } @@ -2879,7 +2497,6 @@ impl crate::Socket { /// Enables a listening socket to hold timewait state when closing the /// connection. This option must be set after `accept` returns. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_dccp_server_timewait(&self, hold_timewait: bool) -> io::Result<()> { unsafe { setsockopt( @@ -2897,7 +2514,6 @@ impl crate::Socket { /// /// [`set_dccp_server_timewait`]: crate::Socket::set_dccp_server_timewait #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_server_timewait(&self) -> io::Result { unsafe { getsockopt( @@ -2916,7 +2532,6 @@ impl crate::Socket { /// accepted by the receiver. Hence, when using this feature on the sender, /// it must be enabled at the receiver too, with suitable choice of CsCov. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_dccp_send_cscov(&self, level: u32) -> io::Result<()> { unsafe { setsockopt( @@ -2934,7 +2549,6 @@ impl crate::Socket { /// /// [`set_dccp_send_cscov`]: crate::Socket::set_dccp_send_cscov #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_send_cscov(&self) -> io::Result { unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_SEND_CSCOV) } } @@ -2945,7 +2559,6 @@ impl crate::Socket { /// /// [`set_dccp_send_cscov`]: crate::Socket::set_dccp_send_cscov #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_dccp_recv_cscov(&self, level: u32) -> io::Result<()> { unsafe { setsockopt( @@ -2963,7 +2576,6 @@ impl crate::Socket { /// /// [`set_dccp_recv_cscov`]: crate::Socket::set_dccp_recv_cscov #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_recv_cscov(&self) -> io::Result { unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_RECV_CSCOV) } } @@ -2973,7 +2585,6 @@ impl crate::Socket { /// This option sets the maximum length of the output queue. A zero value is /// interpreted as unbounded queue length. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn set_dccp_qpolicy_txqlen(&self, length: u32) -> io::Result<()> { unsafe { setsockopt( @@ -2991,7 +2602,6 @@ impl crate::Socket { /// /// [`set_dccp_qpolicy_txqlen`]: crate::Socket::set_dccp_qpolicy_txqlen #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_qpolicy_txqlen(&self) -> io::Result { unsafe { getsockopt( @@ -3012,7 +2622,6 @@ impl crate::Socket { /// /// [documentation]: https://www.kernel.org/doc/html/latest/networking/dccp.html #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_available_ccids(&self) -> io::Result> { let mut endpoints = [0; N]; let mut length = endpoints.len() as libc::socklen_t; @@ -3031,7 +2640,6 @@ impl crate::Socket { /// This option retrieves the current maximum packet size (application /// payload size) in bytes. #[cfg(all(feature = "all", target_os = "linux"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub fn dccp_cur_mps(&self) -> io::Result { unsafe { getsockopt( @@ -3045,7 +2653,6 @@ impl crate::Socket { /// See [`Socket::dccp_available_ccids`]. #[cfg(all(feature = "all", target_os = "linux"))] -#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] #[derive(Debug)] pub struct CcidEndpoints { endpoints: [u8; N], @@ -3053,7 +2660,6 @@ pub struct CcidEndpoints { } #[cfg(all(feature = "all", target_os = "linux"))] -#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] impl std::ops::Deref for CcidEndpoints { type Target = [u8]; @@ -3062,7 +2668,6 @@ impl std::ops::Deref for CcidEndpoints { } } -#[cfg_attr(docsrs, doc(cfg(unix)))] impl AsFd for crate::Socket { fn as_fd(&self) -> BorrowedFd<'_> { // SAFETY: lifetime is bound by self. @@ -3070,14 +2675,12 @@ impl AsFd for crate::Socket { } } -#[cfg_attr(docsrs, doc(cfg(unix)))] impl AsRawFd for crate::Socket { fn as_raw_fd(&self) -> c_int { self.as_raw() } } -#[cfg_attr(docsrs, doc(cfg(unix)))] impl From for OwnedFd { fn from(sock: crate::Socket) -> OwnedFd { // SAFETY: sock.into_raw() always returns a valid fd. @@ -3085,14 +2688,12 @@ impl From for OwnedFd { } } -#[cfg_attr(docsrs, doc(cfg(unix)))] impl IntoRawFd for crate::Socket { fn into_raw_fd(self) -> c_int { self.into_raw() } } -#[cfg_attr(docsrs, doc(cfg(unix)))] impl From for crate::Socket { fn from(fd: OwnedFd) -> crate::Socket { // SAFETY: `OwnedFd` ensures the fd is valid. @@ -3100,7 +2701,6 @@ impl From for crate::Socket { } } -#[cfg_attr(docsrs, doc(cfg(unix)))] impl FromRawFd for crate::Socket { unsafe fn from_raw_fd(fd: c_int) -> crate::Socket { crate::Socket::from_raw(fd) diff --git a/src/sys/windows.rs b/src/sys/windows.rs index 8cf27b53..10852f19 100644 --- a/src/sys/windows.rs +++ b/src/sys/windows.rs @@ -125,7 +125,6 @@ impl Type { /// Set `WSA_FLAG_NO_HANDLE_INHERIT` on the socket. #[cfg(feature = "all")] - #[cfg_attr(docsrs, doc(cfg(all(windows, feature = "all"))))] pub const fn no_inherit(self) -> Type { self._no_inherit() } @@ -946,7 +945,6 @@ pub(crate) fn unix_sockaddr(path: &Path) -> io::Result { impl crate::Socket { /// Sets `HANDLE_FLAG_INHERIT` using `SetHandleInformation`. #[cfg(feature = "all")] - #[cfg_attr(docsrs, doc(cfg(all(windows, feature = "all"))))] pub fn set_no_inherit(&self, no_inherit: bool) -> io::Result<()> { self._set_no_inherit(no_inherit) } @@ -985,7 +983,6 @@ impl crate::Socket { } } -#[cfg_attr(docsrs, doc(cfg(windows)))] impl AsSocket for crate::Socket { fn as_socket(&self) -> BorrowedSocket<'_> { // SAFETY: lifetime is bound by self. @@ -993,14 +990,12 @@ impl AsSocket for crate::Socket { } } -#[cfg_attr(docsrs, doc(cfg(windows)))] impl AsRawSocket for crate::Socket { fn as_raw_socket(&self) -> RawSocket { self.as_raw() as RawSocket } } -#[cfg_attr(docsrs, doc(cfg(windows)))] impl From for OwnedSocket { fn from(sock: crate::Socket) -> OwnedSocket { // SAFETY: sock.into_raw() always returns a valid fd. @@ -1008,14 +1003,12 @@ impl From for OwnedSocket { } } -#[cfg_attr(docsrs, doc(cfg(windows)))] impl IntoRawSocket for crate::Socket { fn into_raw_socket(self) -> RawSocket { self.into_raw() as RawSocket } } -#[cfg_attr(docsrs, doc(cfg(windows)))] impl From for crate::Socket { fn from(fd: OwnedSocket) -> crate::Socket { // SAFETY: `OwnedFd` ensures the fd is valid. @@ -1023,7 +1016,6 @@ impl From for crate::Socket { } } -#[cfg_attr(docsrs, doc(cfg(windows)))] impl FromRawSocket for crate::Socket { unsafe fn from_raw_socket(socket: RawSocket) -> crate::Socket { crate::Socket::from_raw(socket as Socket)