Skip to content

Commit 3a93893

Browse files
authored
Add Apple visionOS support
1 parent 8c97337 commit 3a93893

File tree

6 files changed

+60
-0
lines changed

6 files changed

+60
-0
lines changed

.github/workflows/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
- aarch64-apple-darwin
6161
- aarch64-apple-ios
6262
- aarch64-apple-tvos
63+
- aarch64-apple-visionos
6364
- aarch64-apple-watchos
6465
- aarch64-linux-android
6566
- aarch64-unknown-freebsd

src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ impl TcpKeepalive {
515515
target_os = "fuchsia",
516516
target_os = "illumos",
517517
target_os = "ios",
518+
target_os = "visionos",
518519
target_os = "linux",
519520
target_os = "macos",
520521
target_os = "netbsd",
@@ -531,6 +532,7 @@ impl TcpKeepalive {
531532
target_os = "fuchsia",
532533
target_os = "illumos",
533534
target_os = "ios",
535+
target_os = "visionos",
534536
target_os = "linux",
535537
target_os = "macos",
536538
target_os = "netbsd",
@@ -559,6 +561,7 @@ impl TcpKeepalive {
559561
target_os = "fuchsia",
560562
target_os = "illumos",
561563
target_os = "ios",
564+
target_os = "visionos",
562565
target_os = "linux",
563566
target_os = "macos",
564567
target_os = "netbsd",
@@ -577,6 +580,7 @@ impl TcpKeepalive {
577580
target_os = "fuchsia",
578581
target_os = "illumos",
579582
target_os = "ios",
583+
target_os = "visionos",
580584
target_os = "linux",
581585
target_os = "macos",
582586
target_os = "netbsd",

src/sockaddr.rs

+3
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ impl From<SocketAddrV4> for SockAddr {
291291
target_os = "haiku",
292292
target_os = "hermit",
293293
target_os = "ios",
294+
target_os = "visionos",
294295
target_os = "macos",
295296
target_os = "netbsd",
296297
target_os = "nto",
@@ -334,6 +335,7 @@ impl From<SocketAddrV6> for SockAddr {
334335
target_os = "haiku",
335336
target_os = "hermit",
336337
target_os = "ios",
338+
target_os = "visionos",
337339
target_os = "macos",
338340
target_os = "netbsd",
339341
target_os = "nto",
@@ -358,6 +360,7 @@ impl fmt::Debug for SockAddr {
358360
target_os = "haiku",
359361
target_os = "hermit",
360362
target_os = "ios",
363+
target_os = "visionos",
361364
target_os = "macos",
362365
target_os = "netbsd",
363366
target_os = "nto",

src/socket.rs

+5
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ fn set_common_flags(socket: Socket) -> io::Result<Socket> {
801801
// On Apple platforms set `NOSIGPIPE`.
802802
#[cfg(any(
803803
target_os = "ios",
804+
target_os = "visionos",
804805
target_os = "macos",
805806
target_os = "tvos",
806807
target_os = "watchos",
@@ -2048,6 +2049,7 @@ impl Socket {
20482049
target_os = "fuchsia",
20492050
target_os = "illumos",
20502051
target_os = "ios",
2052+
target_os = "visionos",
20512053
target_os = "linux",
20522054
target_os = "macos",
20532055
target_os = "netbsd",
@@ -2066,6 +2068,7 @@ impl Socket {
20662068
target_os = "fuchsia",
20672069
target_os = "illumos",
20682070
target_os = "ios",
2071+
target_os = "visionos",
20692072
target_os = "linux",
20702073
target_os = "macos",
20712074
target_os = "netbsd",
@@ -2095,6 +2098,7 @@ impl Socket {
20952098
target_os = "fuchsia",
20962099
target_os = "illumos",
20972100
target_os = "ios",
2101+
target_os = "visionos",
20982102
target_os = "linux",
20992103
target_os = "macos",
21002104
target_os = "netbsd",
@@ -2113,6 +2117,7 @@ impl Socket {
21132117
target_os = "fuchsia",
21142118
target_os = "illumos",
21152119
target_os = "ios",
2120+
target_os = "visionos",
21162121
target_os = "linux",
21172122
target_os = "macos",
21182123
target_os = "netbsd",

src/sys/unix.rs

+34
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::net::{Ipv4Addr, Ipv6Addr};
1818
feature = "all",
1919
any(
2020
target_os = "ios",
21+
target_os = "visionos",
2122
target_os = "macos",
2223
target_os = "tvos",
2324
target_os = "watchos",
@@ -31,6 +32,7 @@ use std::num::NonZeroU32;
3132
target_os = "android",
3233
target_os = "freebsd",
3334
target_os = "ios",
35+
target_os = "visionos",
3436
target_os = "linux",
3537
target_os = "macos",
3638
target_os = "tvos",
@@ -46,6 +48,7 @@ use std::os::unix::ffi::OsStrExt;
4648
target_os = "android",
4749
target_os = "freebsd",
4850
target_os = "ios",
51+
target_os = "visionos",
4952
target_os = "linux",
5053
target_os = "macos",
5154
target_os = "tvos",
@@ -63,6 +66,7 @@ use std::{io, slice};
6366

6467
#[cfg(not(any(
6568
target_os = "ios",
69+
target_os = "visionos",
6670
target_os = "macos",
6771
target_os = "tvos",
6872
target_os = "watchos",
@@ -160,13 +164,15 @@ pub(crate) use libc::IP_RECVTOS;
160164
pub(crate) use libc::IP_TOS;
161165
#[cfg(not(any(
162166
target_os = "ios",
167+
target_os = "visionos",
163168
target_os = "macos",
164169
target_os = "tvos",
165170
target_os = "watchos",
166171
)))]
167172
pub(crate) use libc::SO_LINGER;
168173
#[cfg(any(
169174
target_os = "ios",
175+
target_os = "visionos",
170176
target_os = "macos",
171177
target_os = "tvos",
172178
target_os = "watchos",
@@ -202,6 +208,7 @@ pub(crate) use libc::{
202208
target_os = "haiku",
203209
target_os = "illumos",
204210
target_os = "ios",
211+
target_os = "visionos",
205212
target_os = "macos",
206213
target_os = "netbsd",
207214
target_os = "nto",
@@ -217,6 +224,7 @@ pub(crate) use libc::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
217224
target_os = "haiku",
218225
target_os = "illumos",
219226
target_os = "ios",
227+
target_os = "visionos",
220228
target_os = "macos",
221229
target_os = "netbsd",
222230
target_os = "openbsd",
@@ -236,6 +244,7 @@ pub(crate) use libc::{
236244
target_os = "fuchsia",
237245
target_os = "illumos",
238246
target_os = "ios",
247+
target_os = "visionos",
239248
target_os = "linux",
240249
target_os = "macos",
241250
target_os = "netbsd",
@@ -250,6 +259,7 @@ pub(crate) type Bool = c_int;
250259

251260
#[cfg(any(
252261
target_os = "ios",
262+
target_os = "visionos",
253263
target_os = "macos",
254264
target_os = "nto",
255265
target_os = "tvos",
@@ -259,6 +269,7 @@ use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
259269
#[cfg(not(any(
260270
target_os = "haiku",
261271
target_os = "ios",
272+
target_os = "visionos",
262273
target_os = "macos",
263274
target_os = "nto",
264275
target_os = "openbsd",
@@ -284,6 +295,7 @@ macro_rules! syscall {
284295
/// Maximum size of a buffer passed to system call like `recv` and `send`.
285296
#[cfg(not(any(
286297
target_os = "ios",
298+
target_os = "visionos",
287299
target_os = "macos",
288300
target_os = "tvos",
289301
target_os = "watchos",
@@ -300,6 +312,7 @@ const MAX_BUF_LEN: usize = ssize_t::MAX as usize;
300312
// both platforms.
301313
#[cfg(any(
302314
target_os = "ios",
315+
target_os = "visionos",
303316
target_os = "macos",
304317
target_os = "tvos",
305318
target_os = "watchos",
@@ -339,6 +352,7 @@ type IovLen = usize;
339352
target_os = "hurd",
340353
target_os = "illumos",
341354
target_os = "ios",
355+
target_os = "visionos",
342356
target_os = "macos",
343357
target_os = "netbsd",
344358
target_os = "nto",
@@ -1234,6 +1248,7 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
12341248
target_os = "hurd",
12351249
target_os = "illumos",
12361250
target_os = "ios",
1251+
target_os = "visionos",
12371252
target_os = "linux",
12381253
target_os = "macos",
12391254
target_os = "netbsd",
@@ -1462,6 +1477,7 @@ impl crate::Socket {
14621477
#[cfg_attr(
14631478
any(
14641479
target_os = "ios",
1480+
target_os = "visionos",
14651481
target_os = "macos",
14661482
target_os = "tvos",
14671483
target_os = "watchos"
@@ -1498,6 +1514,7 @@ impl crate::Socket {
14981514
feature = "all",
14991515
any(
15001516
target_os = "ios",
1517+
target_os = "visionos",
15011518
target_os = "macos",
15021519
target_os = "tvos",
15031520
target_os = "watchos",
@@ -1509,6 +1526,7 @@ impl crate::Socket {
15091526
feature = "all",
15101527
any(
15111528
target_os = "ios",
1529+
target_os = "visionos",
15121530
target_os = "macos",
15131531
target_os = "tvos",
15141532
target_os = "watchos",
@@ -1521,6 +1539,7 @@ impl crate::Socket {
15211539

15221540
#[cfg(any(
15231541
target_os = "ios",
1542+
target_os = "visionos",
15241543
target_os = "macos",
15251544
target_os = "tvos",
15261545
target_os = "watchos",
@@ -1957,6 +1976,7 @@ impl crate::Socket {
19571976
feature = "all",
19581977
any(
19591978
target_os = "ios",
1979+
target_os = "visionos",
19601980
target_os = "macos",
19611981
target_os = "tvos",
19621982
target_os = "watchos",
@@ -1968,6 +1988,7 @@ impl crate::Socket {
19681988
feature = "all",
19691989
any(
19701990
target_os = "ios",
1991+
target_os = "visionos",
19711992
target_os = "macos",
19721993
target_os = "tvos",
19731994
target_os = "watchos",
@@ -1993,6 +2014,7 @@ impl crate::Socket {
19932014
feature = "all",
19942015
any(
19952016
target_os = "ios",
2017+
target_os = "visionos",
19962018
target_os = "macos",
19972019
target_os = "tvos",
19982020
target_os = "watchos",
@@ -2004,6 +2026,7 @@ impl crate::Socket {
20042026
feature = "all",
20052027
any(
20062028
target_os = "ios",
2029+
target_os = "visionos",
20072030
target_os = "macos",
20082031
target_os = "tvos",
20092032
target_os = "watchos",
@@ -2029,6 +2052,7 @@ impl crate::Socket {
20292052
feature = "all",
20302053
any(
20312054
target_os = "ios",
2055+
target_os = "visionos",
20322056
target_os = "macos",
20332057
target_os = "tvos",
20342058
target_os = "watchos",
@@ -2040,6 +2064,7 @@ impl crate::Socket {
20402064
feature = "all",
20412065
any(
20422066
target_os = "ios",
2067+
target_os = "visionos",
20432068
target_os = "macos",
20442069
target_os = "tvos",
20452070
target_os = "watchos",
@@ -2060,6 +2085,7 @@ impl crate::Socket {
20602085
feature = "all",
20612086
any(
20622087
target_os = "ios",
2088+
target_os = "visionos",
20632089
target_os = "macos",
20642090
target_os = "tvos",
20652091
target_os = "watchos",
@@ -2071,6 +2097,7 @@ impl crate::Socket {
20712097
feature = "all",
20722098
any(
20732099
target_os = "ios",
2100+
target_os = "visionos",
20742101
target_os = "macos",
20752102
target_os = "tvos",
20762103
target_os = "watchos",
@@ -2088,6 +2115,7 @@ impl crate::Socket {
20882115
feature = "all",
20892116
any(
20902117
target_os = "ios",
2118+
target_os = "visionos",
20912119
target_os = "macos",
20922120
target_os = "tvos",
20932121
target_os = "watchos",
@@ -2099,6 +2127,7 @@ impl crate::Socket {
20992127
feature = "all",
21002128
any(
21012129
target_os = "ios",
2130+
target_os = "visionos",
21022131
target_os = "macos",
21032132
target_os = "tvos",
21042133
target_os = "watchos",
@@ -2119,6 +2148,7 @@ impl crate::Socket {
21192148
feature = "all",
21202149
any(
21212150
target_os = "ios",
2151+
target_os = "visionos",
21222152
target_os = "macos",
21232153
target_os = "tvos",
21242154
target_os = "watchos",
@@ -2130,6 +2160,7 @@ impl crate::Socket {
21302160
feature = "all",
21312161
any(
21322162
target_os = "ios",
2163+
target_os = "visionos",
21332164
target_os = "macos",
21342165
target_os = "tvos",
21352166
target_os = "watchos",
@@ -2453,6 +2484,7 @@ impl crate::Socket {
24532484
target_os = "android",
24542485
target_os = "freebsd",
24552486
target_os = "ios",
2487+
target_os = "visionos",
24562488
target_os = "linux",
24572489
target_os = "macos",
24582490
target_os = "tvos",
@@ -2468,6 +2500,7 @@ impl crate::Socket {
24682500
target_os = "android",
24692501
target_os = "freebsd",
24702502
target_os = "ios",
2503+
target_os = "visionos",
24712504
target_os = "linux",
24722505
target_os = "macos",
24732506
target_os = "tvos",
@@ -2491,6 +2524,7 @@ impl crate::Socket {
24912524
feature = "all",
24922525
any(
24932526
target_os = "ios",
2527+
target_os = "visionos",
24942528
target_os = "macos",
24952529
target_os = "tvos",
24962530
target_os = "watchos",

0 commit comments

Comments
 (0)