Skip to content

Commit 2d4e79a

Browse files
committed
Add Apple visionOS support
1 parent c93cdcc commit 2d4e79a

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ impl TcpKeepalive {
514514
target_os = "fuchsia",
515515
target_os = "illumos",
516516
target_os = "ios",
517+
target_os = "visionos",
517518
target_os = "linux",
518519
target_os = "macos",
519520
target_os = "netbsd",
@@ -530,6 +531,7 @@ impl TcpKeepalive {
530531
target_os = "fuchsia",
531532
target_os = "illumos",
532533
target_os = "ios",
534+
target_os = "visionos",
533535
target_os = "linux",
534536
target_os = "macos",
535537
target_os = "netbsd",
@@ -558,6 +560,7 @@ impl TcpKeepalive {
558560
target_os = "fuchsia",
559561
target_os = "illumos",
560562
target_os = "ios",
563+
target_os = "visionos",
561564
target_os = "linux",
562565
target_os = "macos",
563566
target_os = "netbsd",
@@ -576,6 +579,7 @@ impl TcpKeepalive {
576579
target_os = "fuchsia",
577580
target_os = "illumos",
578581
target_os = "ios",
582+
target_os = "visionos",
579583
target_os = "linux",
580584
target_os = "macos",
581585
target_os = "netbsd",

src/sockaddr.rs

Lines changed: 3 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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",
@@ -1947,6 +1948,7 @@ impl Socket {
19471948
target_os = "fuchsia",
19481949
target_os = "illumos",
19491950
target_os = "ios",
1951+
target_os = "visionos",
19501952
target_os = "linux",
19511953
target_os = "macos",
19521954
target_os = "netbsd",
@@ -1965,6 +1967,7 @@ impl Socket {
19651967
target_os = "fuchsia",
19661968
target_os = "illumos",
19671969
target_os = "ios",
1970+
target_os = "visionos",
19681971
target_os = "linux",
19691972
target_os = "macos",
19701973
target_os = "netbsd",
@@ -1994,6 +1997,7 @@ impl Socket {
19941997
target_os = "fuchsia",
19951998
target_os = "illumos",
19961999
target_os = "ios",
2000+
target_os = "visionos",
19972001
target_os = "linux",
19982002
target_os = "macos",
19992003
target_os = "netbsd",
@@ -2012,6 +2016,7 @@ impl Socket {
20122016
target_os = "fuchsia",
20132017
target_os = "illumos",
20142018
target_os = "ios",
2019+
target_os = "visionos",
20152020
target_os = "linux",
20162021
target_os = "macos",
20172022
target_os = "netbsd",

src/sys/unix.rs

Lines changed: 34 additions & 0 deletions
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",
@@ -200,6 +206,7 @@ pub(crate) use libc::{
200206
target_os = "haiku",
201207
target_os = "illumos",
202208
target_os = "ios",
209+
target_os = "visionos",
203210
target_os = "macos",
204211
target_os = "netbsd",
205212
target_os = "nto",
@@ -215,6 +222,7 @@ pub(crate) use libc::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
215222
target_os = "haiku",
216223
target_os = "illumos",
217224
target_os = "ios",
225+
target_os = "visionos",
218226
target_os = "macos",
219227
target_os = "netbsd",
220228
target_os = "openbsd",
@@ -234,6 +242,7 @@ pub(crate) use libc::{
234242
target_os = "fuchsia",
235243
target_os = "illumos",
236244
target_os = "ios",
245+
target_os = "visionos",
237246
target_os = "linux",
238247
target_os = "macos",
239248
target_os = "netbsd",
@@ -248,6 +257,7 @@ pub(crate) type Bool = c_int;
248257

249258
#[cfg(any(
250259
target_os = "ios",
260+
target_os = "visionos",
251261
target_os = "macos",
252262
target_os = "nto",
253263
target_os = "tvos",
@@ -257,6 +267,7 @@ use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
257267
#[cfg(not(any(
258268
target_os = "haiku",
259269
target_os = "ios",
270+
target_os = "visionos",
260271
target_os = "macos",
261272
target_os = "nto",
262273
target_os = "openbsd",
@@ -282,6 +293,7 @@ macro_rules! syscall {
282293
/// Maximum size of a buffer passed to system call like `recv` and `send`.
283294
#[cfg(not(any(
284295
target_os = "ios",
296+
target_os = "visionos",
285297
target_os = "macos",
286298
target_os = "tvos",
287299
target_os = "watchos",
@@ -298,6 +310,7 @@ const MAX_BUF_LEN: usize = ssize_t::MAX as usize;
298310
// both platforms.
299311
#[cfg(any(
300312
target_os = "ios",
313+
target_os = "visionos",
301314
target_os = "macos",
302315
target_os = "tvos",
303316
target_os = "watchos",
@@ -337,6 +350,7 @@ type IovLen = usize;
337350
target_os = "hurd",
338351
target_os = "illumos",
339352
target_os = "ios",
353+
target_os = "visionos",
340354
target_os = "macos",
341355
target_os = "netbsd",
342356
target_os = "nto",
@@ -1227,6 +1241,7 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
12271241
target_os = "hurd",
12281242
target_os = "illumos",
12291243
target_os = "ios",
1244+
target_os = "visionos",
12301245
target_os = "linux",
12311246
target_os = "macos",
12321247
target_os = "netbsd",
@@ -1455,6 +1470,7 @@ impl crate::Socket {
14551470
#[cfg_attr(
14561471
any(
14571472
target_os = "ios",
1473+
target_os = "visionos",
14581474
target_os = "macos",
14591475
target_os = "tvos",
14601476
target_os = "watchos"
@@ -1491,6 +1507,7 @@ impl crate::Socket {
14911507
feature = "all",
14921508
any(
14931509
target_os = "ios",
1510+
target_os = "visionos",
14941511
target_os = "macos",
14951512
target_os = "tvos",
14961513
target_os = "watchos",
@@ -1502,6 +1519,7 @@ impl crate::Socket {
15021519
feature = "all",
15031520
any(
15041521
target_os = "ios",
1522+
target_os = "visionos",
15051523
target_os = "macos",
15061524
target_os = "tvos",
15071525
target_os = "watchos",
@@ -1514,6 +1532,7 @@ impl crate::Socket {
15141532

15151533
#[cfg(any(
15161534
target_os = "ios",
1535+
target_os = "visionos",
15171536
target_os = "macos",
15181537
target_os = "tvos",
15191538
target_os = "watchos",
@@ -1950,6 +1969,7 @@ impl crate::Socket {
19501969
feature = "all",
19511970
any(
19521971
target_os = "ios",
1972+
target_os = "visionos",
19531973
target_os = "macos",
19541974
target_os = "tvos",
19551975
target_os = "watchos",
@@ -1961,6 +1981,7 @@ impl crate::Socket {
19611981
feature = "all",
19621982
any(
19631983
target_os = "ios",
1984+
target_os = "visionos",
19641985
target_os = "macos",
19651986
target_os = "tvos",
19661987
target_os = "watchos",
@@ -1986,6 +2007,7 @@ impl crate::Socket {
19862007
feature = "all",
19872008
any(
19882009
target_os = "ios",
2010+
target_os = "visionos",
19892011
target_os = "macos",
19902012
target_os = "tvos",
19912013
target_os = "watchos",
@@ -1997,6 +2019,7 @@ impl crate::Socket {
19972019
feature = "all",
19982020
any(
19992021
target_os = "ios",
2022+
target_os = "visionos",
20002023
target_os = "macos",
20012024
target_os = "tvos",
20022025
target_os = "watchos",
@@ -2022,6 +2045,7 @@ impl crate::Socket {
20222045
feature = "all",
20232046
any(
20242047
target_os = "ios",
2048+
target_os = "visionos",
20252049
target_os = "macos",
20262050
target_os = "tvos",
20272051
target_os = "watchos",
@@ -2033,6 +2057,7 @@ impl crate::Socket {
20332057
feature = "all",
20342058
any(
20352059
target_os = "ios",
2060+
target_os = "visionos",
20362061
target_os = "macos",
20372062
target_os = "tvos",
20382063
target_os = "watchos",
@@ -2053,6 +2078,7 @@ impl crate::Socket {
20532078
feature = "all",
20542079
any(
20552080
target_os = "ios",
2081+
target_os = "visionos",
20562082
target_os = "macos",
20572083
target_os = "tvos",
20582084
target_os = "watchos",
@@ -2064,6 +2090,7 @@ impl crate::Socket {
20642090
feature = "all",
20652091
any(
20662092
target_os = "ios",
2093+
target_os = "visionos",
20672094
target_os = "macos",
20682095
target_os = "tvos",
20692096
target_os = "watchos",
@@ -2081,6 +2108,7 @@ impl crate::Socket {
20812108
feature = "all",
20822109
any(
20832110
target_os = "ios",
2111+
target_os = "visionos",
20842112
target_os = "macos",
20852113
target_os = "tvos",
20862114
target_os = "watchos",
@@ -2092,6 +2120,7 @@ impl crate::Socket {
20922120
feature = "all",
20932121
any(
20942122
target_os = "ios",
2123+
target_os = "visionos",
20952124
target_os = "macos",
20962125
target_os = "tvos",
20972126
target_os = "watchos",
@@ -2112,6 +2141,7 @@ impl crate::Socket {
21122141
feature = "all",
21132142
any(
21142143
target_os = "ios",
2144+
target_os = "visionos",
21152145
target_os = "macos",
21162146
target_os = "tvos",
21172147
target_os = "watchos",
@@ -2123,6 +2153,7 @@ impl crate::Socket {
21232153
feature = "all",
21242154
any(
21252155
target_os = "ios",
2156+
target_os = "visionos",
21262157
target_os = "macos",
21272158
target_os = "tvos",
21282159
target_os = "watchos",
@@ -2446,6 +2477,7 @@ impl crate::Socket {
24462477
target_os = "android",
24472478
target_os = "freebsd",
24482479
target_os = "ios",
2480+
target_os = "visionos",
24492481
target_os = "linux",
24502482
target_os = "macos",
24512483
target_os = "tvos",
@@ -2461,6 +2493,7 @@ impl crate::Socket {
24612493
target_os = "android",
24622494
target_os = "freebsd",
24632495
target_os = "ios",
2496+
target_os = "visionos",
24642497
target_os = "linux",
24652498
target_os = "macos",
24662499
target_os = "tvos",
@@ -2484,6 +2517,7 @@ impl crate::Socket {
24842517
feature = "all",
24852518
any(
24862519
target_os = "ios",
2520+
target_os = "visionos",
24872521
target_os = "macos",
24882522
target_os = "tvos",
24892523
target_os = "watchos",

0 commit comments

Comments
 (0)