@@ -5,9 +5,10 @@ use crate::{
5
5
io:: { self , BorrowedBuf , BorrowedCursor , ErrorKind , IoSlice , IoSliceMut } ,
6
6
mem,
7
7
net:: { Shutdown , SocketAddr } ,
8
+ os:: solid:: io:: { AsRawFd , FromRawFd , IntoRawFd } ,
8
9
ptr, str,
9
10
sys_common:: net:: { getsockopt, setsockopt, sockaddr_to_addr} ,
10
- sys_common:: { AsInner , FromInner , IntoInner } ,
11
+ sys_common:: IntoInner ,
11
12
time:: Duration ,
12
13
} ;
13
14
@@ -111,13 +112,6 @@ impl FileDesc {
111
112
}
112
113
}
113
114
114
- impl AsInner < c_int > for FileDesc {
115
- #[ inline]
116
- fn as_inner ( & self ) -> & c_int {
117
- & self . fd
118
- }
119
- }
120
-
121
115
impl Drop for FileDesc {
122
116
fn drop ( & mut self ) {
123
117
unsafe { netc:: close ( self . fd ) } ;
@@ -446,7 +440,7 @@ impl Socket {
446
440
pub fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
447
441
let mut nonblocking = nonblocking as c_int ;
448
442
cvt ( unsafe {
449
- netc:: ioctl ( * self . as_inner ( ) , netc:: FIONBIO , ( & mut nonblocking) as * mut c_int as _ )
443
+ netc:: ioctl ( self . 0 . raw ( ) , netc:: FIONBIO , ( & mut nonblocking) as * mut c_int as _ )
450
444
} )
451
445
. map ( drop)
452
446
}
@@ -458,25 +452,27 @@ impl Socket {
458
452
459
453
// This method is used by sys_common code to abstract over targets.
460
454
pub fn as_raw ( & self ) -> c_int {
461
- * self . as_inner ( )
455
+ self . 0 . raw ( )
462
456
}
463
457
}
464
458
465
- impl AsInner < c_int > for Socket {
459
+ impl AsRawFd for Socket {
466
460
#[ inline]
467
- fn as_inner ( & self ) -> & c_int {
468
- self . 0 . as_inner ( )
461
+ fn as_raw_fd ( & self ) -> c_int {
462
+ self . 0 . fd
469
463
}
470
464
}
471
465
472
- impl FromInner < c_int > for Socket {
473
- fn from_inner ( fd : c_int ) -> Socket {
466
+ impl FromRawFd for Socket {
467
+ #[ inline]
468
+ unsafe fn from_raw_fd ( fd : c_int ) -> Socket {
474
469
Socket ( FileDesc :: new ( fd) )
475
470
}
476
471
}
477
472
478
- impl IntoInner < c_int > for Socket {
479
- fn into_inner ( self ) -> c_int {
473
+ impl IntoRawFd for Socket {
474
+ #[ inline]
475
+ fn into_raw_fd ( self ) -> c_int {
480
476
self . 0 . into_raw ( )
481
477
}
482
478
}
0 commit comments