Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
- aarch64-unknown-redox
- arm-linux-androideabi
- arm64_32-apple-watchos
- armv6k-nintendo-3ds
- armv7-linux-androideabi
- armv7-sony-vita-newlibeabihf
- armv7-unknown-linux-ohos
Expand Down
42 changes: 27 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
#![doc(test(attr(deny(warnings))))]

use std::fmt;
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
use std::io::IoSlice;
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
use std::marker::PhantomData;
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
use std::mem;
use std::mem::MaybeUninit;
use std::net::SocketAddr;
Expand Down Expand Up @@ -279,13 +279,21 @@ impl Type {
pub const DCCP: Type = Type(sys::SOCK_DCCP);

/// Type corresponding to `SOCK_SEQPACKET`.
#[cfg(all(feature = "all", not(any(target_os = "espidf", target_os = "wasi"))))]
#[cfg(all(
feature = "all",
not(any(target_os = "espidf", target_os = "wasi", target_os = "horizon"))
))]
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", target_os = "wasi"))
not(any(
target_os = "redox",
target_os = "espidf",
target_os = "wasi",
target_os = "horizon"
))
))]
pub const RAW: Type = Type(sys::SOCK_RAW);
}
Expand Down Expand Up @@ -371,11 +379,11 @@ impl From<Protocol> for c_int {
/// Flags for incoming messages.
///
/// Flags provide additional information about incoming messages.
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RecvFlags(c_int);

#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
impl RecvFlags {
/// Check if the message contains a truncated datagram.
///
Expand Down Expand Up @@ -445,6 +453,7 @@ pub struct TcpKeepalive {
target_os = "espidf",
target_os = "vita",
target_os = "haiku",
target_os = "horizon"
)))]
interval: Option<Duration>,
#[cfg(not(any(
Expand All @@ -455,6 +464,7 @@ pub struct TcpKeepalive {
target_os = "espidf",
target_os = "vita",
target_os = "haiku",
target_os = "horizon"
)))]
retries: Option<u32>,
}
Expand All @@ -473,6 +483,7 @@ impl TcpKeepalive {
target_os = "espidf",
target_os = "vita",
target_os = "haiku",
target_os = "horizon"
)))]
interval: None,
#[cfg(not(any(
Expand All @@ -483,6 +494,7 @@ impl TcpKeepalive {
target_os = "espidf",
target_os = "vita",
target_os = "haiku",
target_os = "horizon"
)))]
retries: None,
}
Expand Down Expand Up @@ -573,15 +585,15 @@ impl TcpKeepalive {
///
/// This wraps `msghdr` on Unix and `WSAMSG` on Windows. Also see [`MsgHdrMut`]
/// for the variant used by `recvmsg(2)`.
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
#[repr(transparent)]
pub struct MsgHdr<'addr, 'bufs, 'control> {
inner: sys::msghdr,
#[allow(clippy::type_complexity)]
_lifetimes: PhantomData<(&'addr SockAddr, &'bufs IoSlice<'bufs>, &'control [u8])>,
}

#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> {
/// Create a new `MsgHdr` with all empty/zero fields.
#[allow(clippy::new_without_default)]
Expand Down Expand Up @@ -631,21 +643,21 @@ impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> {
}
}

#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
impl<'name, 'bufs, 'control> fmt::Debug for MsgHdr<'name, 'bufs, 'control> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
"MsgHdr".fmt(fmt)
}
}

#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
unsafe impl Send for MsgHdr<'_, '_, '_> {}

/// Configuration of a `recvmsg(2)` system call.
///
/// This wraps `msghdr` on Unix and `WSAMSG` on Windows. Also see [`MsgHdr`] for
/// the variant used by `sendmsg(2)`.
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
#[repr(transparent)]
pub struct MsgHdrMut<'addr, 'bufs, 'control> {
inner: sys::msghdr,
Expand All @@ -657,7 +669,7 @@ pub struct MsgHdrMut<'addr, 'bufs, 'control> {
)>,
}

#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
impl<'addr, 'bufs, 'control> MsgHdrMut<'addr, 'bufs, 'control> {
/// Create a new `MsgHdrMut` with all empty/zero fields.
#[allow(clippy::new_without_default)]
Expand Down Expand Up @@ -712,12 +724,12 @@ impl<'addr, 'bufs, 'control> MsgHdrMut<'addr, 'bufs, 'control> {
}
}

#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
impl<'name, 'bufs, 'control> fmt::Debug for MsgHdrMut<'name, 'bufs, 'control> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
"MsgHdrMut".fmt(fmt)
}
}

#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))]
unsafe impl Send for MsgHdrMut<'_, '_, '_> {}
Loading
Loading