@@ -5,9 +5,10 @@ use crate::{
55 io:: { self , BorrowedBuf , BorrowedCursor , ErrorKind , IoSlice , IoSliceMut } ,
66 mem,
77 net:: { Shutdown , SocketAddr } ,
8+ os:: solid:: io:: { AsRawFd , FromRawFd , IntoRawFd } ,
89 ptr, str,
910 sys_common:: net:: { getsockopt, setsockopt, sockaddr_to_addr} ,
10- sys_common:: { AsInner , FromInner , IntoInner } ,
11+ sys_common:: IntoInner ,
1112 time:: Duration ,
1213} ;
1314
@@ -111,13 +112,6 @@ impl FileDesc {
111112 }
112113}
113114
114- impl AsInner < c_int > for FileDesc {
115- #[ inline]
116- fn as_inner ( & self ) -> & c_int {
117- & self . fd
118- }
119- }
120-
121115impl Drop for FileDesc {
122116 fn drop ( & mut self ) {
123117 unsafe { netc:: close ( self . fd ) } ;
@@ -454,7 +448,7 @@ impl Socket {
454448 pub fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
455449 let mut nonblocking = nonblocking as c_int ;
456450 cvt ( unsafe {
457- netc:: ioctl ( * self . as_inner ( ) , netc:: FIONBIO , ( & mut nonblocking) as * mut c_int as _ )
451+ netc:: ioctl ( self . 0 . raw ( ) , netc:: FIONBIO , ( & mut nonblocking) as * mut c_int as _ )
458452 } )
459453 . map ( drop)
460454 }
@@ -466,25 +460,27 @@ impl Socket {
466460
467461 // This method is used by sys_common code to abstract over targets.
468462 pub fn as_raw ( & self ) -> c_int {
469- * self . as_inner ( )
463+ self . 0 . raw ( )
470464 }
471465}
472466
473- impl AsInner < c_int > for Socket {
467+ impl AsRawFd for Socket {
474468 #[ inline]
475- fn as_inner ( & self ) -> & c_int {
476- self . 0 . as_inner ( )
469+ fn as_raw_fd ( & self ) -> c_int {
470+ self . 0 . fd
477471 }
478472}
479473
480- impl FromInner < c_int > for Socket {
481- fn from_inner ( fd : c_int ) -> Socket {
474+ impl FromRawFd for Socket {
475+ #[ inline]
476+ unsafe fn from_raw_fd ( fd : c_int ) -> Socket {
482477 Socket ( FileDesc :: new ( fd) )
483478 }
484479}
485480
486- impl IntoInner < c_int > for Socket {
487- fn into_inner ( self ) -> c_int {
481+ impl IntoRawFd for Socket {
482+ #[ inline]
483+ fn into_raw_fd ( self ) -> c_int {
488484 self . 0 . into_raw ( )
489485 }
490486}
0 commit comments