@@ -5,8 +5,12 @@ use crate::sys::time::TimeVal;
5
5
use crate :: Result ;
6
6
use cfg_if:: cfg_if;
7
7
use libc:: { self , c_int, c_void, socklen_t} ;
8
- use std:: ffi:: { CStr , CString , OsStr , OsString } ;
8
+ #[ cfg( apple_targets) ]
9
+ use std:: ffi:: { CStr , CString } ;
10
+ #[ cfg( any( target_os = "freebsd" , linux_android) ) ]
11
+ use std:: ffi:: { OsStr , OsString } ;
9
12
use std:: mem:: { self , MaybeUninit } ;
13
+ #[ cfg( any( target_os = "freebsd" , linux_android) ) ]
10
14
use std:: os:: unix:: ffi:: OsStrExt ;
11
15
use std:: os:: unix:: io:: { AsFd , AsRawFd } ;
12
16
@@ -749,7 +753,12 @@ sockopt_impl!(
749
753
libc:: SO_TIMESTAMPING ,
750
754
super :: TimestampingFlag
751
755
) ;
752
- #[ cfg( not( any( target_os = "aix" , target_os = "haiku" , target_os = "hurd" , target_os = "redox" ) ) ) ]
756
+ #[ cfg( not( any(
757
+ target_os = "aix" ,
758
+ target_os = "haiku" ,
759
+ target_os = "hurd" ,
760
+ target_os = "redox"
761
+ ) ) ) ]
753
762
sockopt_impl ! (
754
763
/// Enable or disable the receiving of the `SO_TIMESTAMP` control message.
755
764
ReceiveTimestamp ,
@@ -1300,7 +1309,6 @@ impl SetSockOpt for TcpTlsRx {
1300
1309
}
1301
1310
}
1302
1311
1303
-
1304
1312
/*
1305
1313
*
1306
1314
* ===== Accessor helpers =====
@@ -1438,11 +1446,13 @@ impl<'a> Set<'a, bool> for SetBool {
1438
1446
}
1439
1447
1440
1448
/// Getter for an `u8` value.
1449
+ #[ cfg( feature = "net" ) ]
1441
1450
struct GetU8 {
1442
1451
len : socklen_t ,
1443
1452
val : MaybeUninit < u8 > ,
1444
1453
}
1445
1454
1455
+ #[ cfg( feature = "net" ) ]
1446
1456
impl Get < u8 > for GetU8 {
1447
1457
fn uninit ( ) -> Self {
1448
1458
GetU8 {
@@ -1470,10 +1480,12 @@ impl Get<u8> for GetU8 {
1470
1480
}
1471
1481
1472
1482
/// Setter for an `u8` value.
1483
+ #[ cfg( feature = "net" ) ]
1473
1484
struct SetU8 {
1474
1485
val : u8 ,
1475
1486
}
1476
1487
1488
+ #[ cfg( feature = "net" ) ]
1477
1489
impl < ' a > Set < ' a , u8 > for SetU8 {
1478
1490
fn new ( val : & ' a u8 ) -> SetU8 {
1479
1491
SetU8 { val : * val }
@@ -1540,11 +1552,13 @@ impl<'a> Set<'a, usize> for SetUsize {
1540
1552
}
1541
1553
1542
1554
/// Getter for a `OsString` value.
1555
+ #[ cfg( any( target_os = "freebsd" , linux_android) ) ]
1543
1556
struct GetOsString < T : AsMut < [ u8 ] > > {
1544
1557
len : socklen_t ,
1545
1558
val : MaybeUninit < T > ,
1546
1559
}
1547
1560
1561
+ #[ cfg( any( target_os = "freebsd" , linux_android) ) ]
1548
1562
impl < T : AsMut < [ u8 ] > > Get < OsString > for GetOsString < T > {
1549
1563
fn uninit ( ) -> Self {
1550
1564
GetOsString {
@@ -1569,10 +1583,12 @@ impl<T: AsMut<[u8]>> Get<OsString> for GetOsString<T> {
1569
1583
}
1570
1584
1571
1585
/// Setter for a `OsString` value.
1586
+ #[ cfg( any( target_os = "freebsd" , linux_android) ) ]
1572
1587
struct SetOsString < ' a > {
1573
1588
val : & ' a OsStr ,
1574
1589
}
1575
1590
1591
+ #[ cfg( any( target_os = "freebsd" , linux_android) ) ]
1576
1592
impl < ' a > Set < ' a , OsString > for SetOsString < ' a > {
1577
1593
fn new ( val : & ' a OsString ) -> SetOsString {
1578
1594
SetOsString {
@@ -1590,11 +1606,13 @@ impl<'a> Set<'a, OsString> for SetOsString<'a> {
1590
1606
}
1591
1607
1592
1608
/// Getter for a `CString` value.
1609
+ #[ cfg( apple_targets) ]
1593
1610
struct GetCString < T : AsMut < [ u8 ] > > {
1594
1611
len : socklen_t ,
1595
1612
val : MaybeUninit < T > ,
1596
1613
}
1597
1614
1615
+ #[ cfg( apple_targets) ]
1598
1616
impl < T : AsMut < [ u8 ] > > Get < CString > for GetCString < T > {
1599
1617
fn uninit ( ) -> Self {
1600
1618
GetCString {
0 commit comments