@@ -118,11 +118,8 @@ impl Socket {
118
118
///
119
119
/// This function sets the same flags as in done for [`Socket::new`],
120
120
/// [`Socket::pair_raw`] can be used if you don't want to set those flags.
121
- ///
122
- /// # Notes
123
- ///
124
- /// This function is only available on Unix.
125
- #[ cfg( all( feature = "all" , unix) ) ]
121
+ #[ cfg( any( doc, all( feature = "all" , unix) ) ) ]
122
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , unix) ) ) ) ]
126
123
pub fn pair (
127
124
domain : Domain ,
128
125
ty : Type ,
@@ -138,11 +135,8 @@ impl Socket {
138
135
/// Creates a pair of sockets which are connected to each other.
139
136
///
140
137
/// This function corresponds to `socketpair(2)`.
141
- ///
142
- /// # Notes
143
- ///
144
- /// This function is only available on Unix.
145
- #[ cfg( all( feature = "all" , unix) ) ]
138
+ #[ cfg( any( doc, all( feature = "all" , unix) ) ) ]
139
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , unix) ) ) ) ]
146
140
pub fn pair_raw (
147
141
domain : Domain ,
148
142
ty : Type ,
@@ -416,6 +410,7 @@ impl Socket {
416
410
/// function with `buf`s of type `&mut [IoSliceMut]`, allowing initialised
417
411
/// buffers to be used without using `unsafe`.
418
412
#[ cfg( not( target_os = "redox" ) ) ]
413
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
419
414
pub fn recv_vectored (
420
415
& self ,
421
416
bufs : & mut [ MaybeUninitSlice < ' _ > ] ,
@@ -435,6 +430,7 @@ impl Socket {
435
430
///
436
431
/// [`recv_vectored`]: Socket::recv_vectored
437
432
#[ cfg( not( target_os = "redox" ) ) ]
433
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
438
434
pub fn recv_vectored_with_flags (
439
435
& self ,
440
436
bufs : & mut [ MaybeUninitSlice < ' _ > ] ,
@@ -498,6 +494,7 @@ impl Socket {
498
494
///
499
495
/// [`recv_vectored`]: Socket::recv_vectored
500
496
#[ cfg( not( target_os = "redox" ) ) ]
497
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
501
498
pub fn recv_from_vectored (
502
499
& self ,
503
500
bufs : & mut [ MaybeUninitSlice < ' _ > ] ,
@@ -517,6 +514,7 @@ impl Socket {
517
514
///
518
515
/// [`recv_vectored`]: Socket::recv_vectored
519
516
#[ cfg( not( target_os = "redox" ) ) ]
517
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
520
518
pub fn recv_from_vectored_with_flags (
521
519
& self ,
522
520
bufs : & mut [ MaybeUninitSlice < ' _ > ] ,
@@ -563,6 +561,7 @@ impl Socket {
563
561
564
562
/// Send data to the connected peer. Returns the amount of bytes written.
565
563
#[ cfg( not( target_os = "redox" ) ) ]
564
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
566
565
pub fn send_vectored ( & self , bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
567
566
self . send_vectored_with_flags ( bufs, 0 )
568
567
}
@@ -572,6 +571,7 @@ impl Socket {
572
571
///
573
572
/// [`send_vectored`]: Socket::send_vectored
574
573
#[ cfg( not( target_os = "redox" ) ) ]
574
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
575
575
pub fn send_vectored_with_flags (
576
576
& self ,
577
577
bufs : & [ IoSlice < ' _ > ] ,
@@ -615,6 +615,7 @@ impl Socket {
615
615
/// Send data to a peer listening on `addr`. Returns the amount of bytes
616
616
/// written.
617
617
#[ cfg( not( target_os = "redox" ) ) ]
618
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
618
619
pub fn send_to_vectored ( & self , bufs : & [ IoSlice < ' _ > ] , addr : & SockAddr ) -> io:: Result < usize > {
619
620
self . send_to_vectored_with_flags ( bufs, addr, 0 )
620
621
}
@@ -624,6 +625,7 @@ impl Socket {
624
625
///
625
626
/// [`send_to_vectored`]: Socket::send_to_vectored
626
627
#[ cfg( not( target_os = "redox" ) ) ]
628
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
627
629
pub fn send_to_vectored_with_flags (
628
630
& self ,
629
631
bufs : & [ IoSlice < ' _ > ] ,
@@ -794,6 +796,7 @@ impl Socket {
794
796
///
795
797
/// [`set_out_of_band_inline`]: Socket::set_out_of_band_inline
796
798
#[ cfg( not( target_os = "redox" ) ) ]
799
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
797
800
pub fn out_of_band_inline ( & self ) -> io:: Result < bool > {
798
801
unsafe {
799
802
getsockopt :: < c_int > ( self . as_raw ( ) , sys:: SOL_SOCKET , sys:: SO_OOBINLINE )
@@ -808,6 +811,7 @@ impl Socket {
808
811
/// `MSG_OOB` flag is set during receiving. As per RFC6093, TCP sockets
809
812
/// using the Urgent mechanism are encouraged to set this flag.
810
813
#[ cfg( not( target_os = "redox" ) ) ]
814
+ #[ cfg_attr( docsrs, doc( cfg( not( target_os = "redox" ) ) ) ) ]
811
815
pub fn set_out_of_band_inline ( & self , oob_inline : bool ) -> io:: Result < ( ) > {
812
816
unsafe {
813
817
setsockopt (
@@ -965,8 +969,9 @@ impl Socket {
965
969
///
966
970
/// For more information about this option, see [`set_ip_transparent`].
967
971
///
968
- /// [`ip_transparent`]: Socket::set_ip_transparent
969
- #[ cfg( all( feature = "all" , target_os = "linux" ) ) ]
972
+ /// [`set_ip_transparent`]: Socket::set_ip_transparent
973
+ #[ cfg( any( doc, all( feature = "all" , target_os = "linux" ) ) ) ]
974
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , target_os = "linux" ) ) ) ) ]
970
975
pub fn ip_transparent ( & self ) -> io:: Result < bool > {
971
976
unsafe {
972
977
getsockopt :: < c_int > ( self . as_raw ( ) , sys:: IPPROTO_IP , libc:: IP_TRANSPARENT )
@@ -989,8 +994,8 @@ impl Socket {
989
994
///
990
995
/// TProxy redirection with the iptables TPROXY target also
991
996
/// requires that this option be set on the redirected socket.
992
- /// this feature is only available on linux
993
- #[ cfg( all( feature = "all" , target_os = "linux" ) ) ]
997
+ # [ cfg ( any ( doc , all ( feature = "all" , target_os = " linux" ) ) ) ]
998
+ #[ cfg_attr ( docsrs , doc ( cfg( all( feature = "all" , target_os = "linux" ) ) ) ) ]
994
999
pub fn set_ip_transparent ( & self , transparent : bool ) -> io:: Result < ( ) > {
995
1000
unsafe {
996
1001
setsockopt (
@@ -1342,7 +1347,8 @@ impl Socket {
1342
1347
/// This returns the value of `SO_KEEPALIVE` on OpenBSD and Haiku,
1343
1348
/// `TCP_KEEPALIVE` on macOS and iOS, and `TCP_KEEPIDLE` on all other Unix
1344
1349
/// operating systems.
1345
- #[ cfg( all( feature = "all" , not( windows) ) ) ]
1350
+ #[ cfg( any( doc, all( feature = "all" , not( windows) ) ) ) ]
1351
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , not( windows) ) ) ) ) ]
1346
1352
pub fn keepalive_time ( & self ) -> io:: Result < Duration > {
1347
1353
sys:: keepalive_time ( self . as_raw ( ) )
1348
1354
}
@@ -1355,6 +1361,7 @@ impl Socket {
1355
1361
#[ cfg( all(
1356
1362
feature = "all" ,
1357
1363
any(
1364
+ doc,
1358
1365
target_os = "android" ,
1359
1366
target_os = "dragonfly" ,
1360
1367
target_os = "freebsd" ,
@@ -1365,6 +1372,22 @@ impl Socket {
1365
1372
target_vendor = "apple" ,
1366
1373
)
1367
1374
) ) ]
1375
+ #[ cfg_attr(
1376
+ docsrs,
1377
+ doc( cfg( all(
1378
+ feature = "all" ,
1379
+ any(
1380
+ target_os = "android" ,
1381
+ target_os = "dragonfly" ,
1382
+ target_os = "freebsd" ,
1383
+ target_os = "fuchsia" ,
1384
+ target_os = "illumos" ,
1385
+ target_os = "linux" ,
1386
+ target_os = "netbsd" ,
1387
+ target_vendor = "apple" ,
1388
+ )
1389
+ ) ) )
1390
+ ) ]
1368
1391
pub fn keepalive_interval ( & self ) -> io:: Result < Duration > {
1369
1392
unsafe {
1370
1393
getsockopt :: < c_int > ( self . as_raw ( ) , sys:: IPPROTO_TCP , sys:: TCP_KEEPINTVL )
@@ -1380,6 +1403,7 @@ impl Socket {
1380
1403
#[ cfg( all(
1381
1404
feature = "all" ,
1382
1405
any(
1406
+ doc,
1383
1407
target_os = "android" ,
1384
1408
target_os = "dragonfly" ,
1385
1409
target_os = "freebsd" ,
@@ -1390,6 +1414,22 @@ impl Socket {
1390
1414
target_vendor = "apple" ,
1391
1415
)
1392
1416
) ) ]
1417
+ #[ cfg_attr(
1418
+ docsrs,
1419
+ doc( cfg( all(
1420
+ feature = "all" ,
1421
+ any(
1422
+ target_os = "android" ,
1423
+ target_os = "dragonfly" ,
1424
+ target_os = "freebsd" ,
1425
+ target_os = "fuchsia" ,
1426
+ target_os = "illumos" ,
1427
+ target_os = "linux" ,
1428
+ target_os = "netbsd" ,
1429
+ target_vendor = "apple" ,
1430
+ )
1431
+ ) ) )
1432
+ ) ]
1393
1433
pub fn keepalive_retries ( & self ) -> io:: Result < u32 > {
1394
1434
unsafe {
1395
1435
getsockopt :: < c_int > ( self . as_raw ( ) , sys:: IPPROTO_TCP , sys:: TCP_KEEPCNT )
0 commit comments