Skip to content

Commit e9e464a

Browse files
authored
Add support for visionOS (#202)
1 parent e8e7849 commit e9e464a

File tree

5 files changed

+10
-40
lines changed

5 files changed

+10
-40
lines changed

examples/kqueue-process.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
//! ```
88
99
#[cfg(any(
10-
target_os = "macos",
11-
target_os = "ios",
12-
target_os = "tvos",
13-
target_os = "watchos",
10+
target_vendor = "apple",
1411
target_os = "freebsd",
1512
target_os = "netbsd",
1613
target_os = "openbsd",
@@ -40,10 +37,7 @@ fn main() -> std::io::Result<()> {
4037
}
4138

4239
#[cfg(not(any(
43-
target_os = "macos",
44-
target_os = "ios",
45-
target_os = "tvos",
46-
target_os = "watchos",
40+
target_vendor = "apple",
4741
target_os = "freebsd",
4842
target_os = "netbsd",
4943
target_os = "openbsd",

src/lib.rs

+5-20
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ unsafe impl<T: IoSafe + Write> IoSafe for std::io::BufWriter<T> {}
12561256
unsafe impl<T: IoSafe + Write> IoSafe for std::io::LineWriter<T> {}
12571257
unsafe impl<T: IoSafe + ?Sized> IoSafe for &mut T {}
12581258
unsafe impl<T: IoSafe + ?Sized> IoSafe for Box<T> {}
1259-
unsafe impl<T: Clone + IoSafe + ?Sized> IoSafe for std::borrow::Cow<'_, T> {}
1259+
unsafe impl<T: Clone + IoSafe> IoSafe for std::borrow::Cow<'_, T> {}
12601260

12611261
impl<T: IoSafe + Read> AsyncRead for Async<T> {
12621262
fn poll_read(
@@ -2101,20 +2101,14 @@ fn connect(
21012101
let socket = {
21022102
#[cfg(not(any(
21032103
target_os = "aix",
2104-
target_os = "macos",
2105-
target_os = "ios",
2106-
target_os = "tvos",
2107-
target_os = "watchos",
2104+
target_vendor = "apple",
21082105
target_os = "espidf",
21092106
windows,
21102107
)))]
21112108
let flags = rn::SocketFlags::CLOEXEC;
21122109
#[cfg(any(
21132110
target_os = "aix",
2114-
target_os = "macos",
2115-
target_os = "ios",
2116-
target_os = "tvos",
2117-
target_os = "watchos",
2111+
target_vendor = "apple",
21182112
target_os = "espidf",
21192113
windows,
21202114
))]
@@ -2124,13 +2118,7 @@ fn connect(
21242118
let socket = rn::socket_with(domain, rn::SocketType::STREAM, flags, protocol)?;
21252119

21262120
// Set cloexec if necessary.
2127-
#[cfg(any(
2128-
target_os = "aix",
2129-
target_os = "macos",
2130-
target_os = "ios",
2131-
target_os = "tvos",
2132-
target_os = "watchos",
2133-
))]
2121+
#[cfg(any(target_os = "aix", target_vendor = "apple"))]
21342122
rio::fcntl_setfd(&socket, rio::fcntl_getfd(&socket)? | rio::FdFlags::CLOEXEC)?;
21352123

21362124
// Set non-blocking mode.
@@ -2141,10 +2129,7 @@ fn connect(
21412129

21422130
// Set nosigpipe if necessary.
21432131
#[cfg(any(
2144-
target_os = "macos",
2145-
target_os = "ios",
2146-
target_os = "tvos",
2147-
target_os = "watchos",
2132+
target_vendor = "apple",
21482133
target_os = "freebsd",
21492134
target_os = "netbsd",
21502135
target_os = "dragonfly",

src/os.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
pub mod unix;
55

66
#[cfg(any(
7-
target_os = "macos",
8-
target_os = "ios",
9-
target_os = "tvos",
10-
target_os = "watchos",
7+
target_vendor = "apple",
118
target_os = "freebsd",
129
target_os = "netbsd",
1310
target_os = "openbsd",

src/os/unix.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ pub fn reactor_fd() -> Option<BorrowedFd<'static>> {
4848
target_os = "android",
4949
target_os = "illumos",
5050
target_os = "solaris",
51-
target_os = "macos",
52-
target_os = "ios",
53-
target_os = "tvos",
54-
target_os = "watchos",
51+
target_vendor = "apple",
5552
target_os = "freebsd",
5653
target_os = "netbsd",
5754
target_os = "openbsd",

src/reactor.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ cfg_if::cfg_if! {
2424
mod windows;
2525
pub use windows::Registration;
2626
} else if #[cfg(any(
27-
target_os = "macos",
28-
target_os = "ios",
29-
target_os = "tvos",
30-
target_os = "watchos",
27+
target_vendor = "apple",
3128
target_os = "freebsd",
3229
target_os = "netbsd",
3330
target_os = "openbsd",

0 commit comments

Comments
 (0)