Skip to content

Commit

Permalink
Fix various doc attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasdezeeuw committed Feb 26, 2023
1 parent 4b5728c commit 2dc7235
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl Type {
///
/// Used for the DCCP protocol.
#[cfg(all(feature = "all", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(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`.
Expand Down Expand Up @@ -316,7 +316,7 @@ impl Protocol {

/// Protocol corresponding to `DCCP`.
#[cfg(all(feature = "all", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub const DCCP: Protocol = Protocol(sys::IPPROTO_DCCP);

#[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))]
Expand Down
6 changes: 3 additions & 3 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ impl Socket {
///
/// On Windows it is not possible retrieve the nonblocking mode status.
#[cfg(all(feature = "all", unix))]
#[cfg_attr(docsrs, doc(all(feature = "all", unix)))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", unix))))]
pub fn nonblocking(&self) -> io::Result<bool> {
sys::nonblocking(self.as_raw())
}
Expand Down Expand Up @@ -1084,7 +1084,7 @@ impl Socket {
///
/// [`set_header_included`]: Socket::set_header_included
#[cfg(all(feature = "all", not(target_os = "redox")))]
#[cfg_attr(docsrs, doc(all(feature = "all", not(target_os = "redox"))))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", not(target_os = "redox")))))]
pub fn header_included(&self) -> io::Result<bool> {
unsafe {
getsockopt::<c_int>(self.as_raw(), sys::IPPROTO_IP, sys::IP_HDRINCL)
Expand All @@ -1104,7 +1104,7 @@ impl Socket {
/// [`IP_TTL`]: Socket::set_ttl
/// [`IP_TOS`]: Socket::set_tos
#[cfg(all(feature = "all", not(target_os = "redox")))]
#[cfg_attr(docsrs, doc(all(feature = "all", not(target_os = "redox"))))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", not(target_os = "redox")))))]
pub fn set_header_included(&self, included: bool) -> io::Result<()> {
unsafe {
setsockopt(
Expand Down
34 changes: 17 additions & 17 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2428,7 +2428,7 @@ impl crate::Socket {
/// [`connect`]: crate::Socket::connect
/// [`bind`]: crate::Socket::bind
#[cfg(all(feature = "all", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(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(
Expand All @@ -2446,7 +2446,7 @@ impl crate::Socket {
///
/// [`set_dccp_service`]: crate::Socket::set_dccp_service
#[cfg(all(feature = "all", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_service(&self) -> io::Result<u32> {
unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_SERVICE) }
}
Expand All @@ -2455,7 +2455,7 @@ 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(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) }
}
Expand All @@ -2466,7 +2466,7 @@ impl crate::Socket {
///
/// [`set_dccp_ccid`]: crate::Socket::set_dccp_ccid
#[cfg(all(feature = "all", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_tx_ccid(&self) -> io::Result<u32> {
unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_TX_CCID) }
}
Expand All @@ -2477,7 +2477,7 @@ impl crate::Socket {
///
/// [`set_dccp_ccid`]: crate::Socket::set_dccp_ccid
#[cfg(all(feature = "all", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_xx_ccid(&self) -> io::Result<u32> {
unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_RX_CCID) }
}
Expand All @@ -2487,7 +2487,7 @@ 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(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(
Expand All @@ -2505,7 +2505,7 @@ 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(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_server_timewait(&self) -> io::Result<bool> {
unsafe {
getsockopt(
Expand All @@ -2524,7 +2524,7 @@ 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(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(
Expand All @@ -2542,7 +2542,7 @@ 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(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_send_cscov(&self) -> io::Result<u32> {
unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_SEND_CSCOV) }
}
Expand All @@ -2553,7 +2553,7 @@ 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(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(
Expand All @@ -2571,7 +2571,7 @@ 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(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_recv_cscov(&self) -> io::Result<u32> {
unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_RECV_CSCOV) }
}
Expand All @@ -2581,7 +2581,7 @@ 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(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(
Expand All @@ -2599,7 +2599,7 @@ 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(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_qpolicy_txqlen(&self) -> io::Result<u32> {
unsafe {
getsockopt(
Expand All @@ -2620,7 +2620,7 @@ 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(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_available_ccids<const N: usize>(&self) -> io::Result<CcidEndpoints<N>> {
let mut endpoints = [0; N];
let mut length = endpoints.len() as libc::socklen_t;
Expand All @@ -2639,7 +2639,7 @@ 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(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
pub fn dccp_cur_mps(&self) -> io::Result<u32> {
unsafe {
getsockopt(
Expand All @@ -2653,15 +2653,15 @@ impl crate::Socket {

/// See [`Socket::dccp_available_ccids`].
#[cfg(all(feature = "all", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
#[derive(Debug)]
pub struct CcidEndpoints<const N: usize> {
endpoints: [u8; N],
length: u32,
}

#[cfg(all(feature = "all", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(feature = "all", target_os = "linux")))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
impl<const N: usize> std::ops::Deref for CcidEndpoints<N> {
type Target = [u8];

Expand Down

0 comments on commit 2dc7235

Please sign in to comment.