File tree Expand file tree Collapse file tree 3 files changed +12
-33
lines changed Expand file tree Collapse file tree 3 files changed +12
-33
lines changed Original file line number Diff line number Diff line change @@ -906,13 +906,21 @@ impl Socket {
906
906
907
907
impl Read for Socket {
908
908
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
909
- self . inner ( ) . read ( buf)
909
+ self . recv ( buf)
910
+ }
911
+
912
+ fn read_vectored ( & mut self , bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
913
+ self . recv_vectored ( bufs) . map ( |( n, _) | n)
910
914
}
911
915
}
912
916
913
917
impl < ' a > Read for & ' a Socket {
914
918
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
915
- self . inner ( ) . read ( buf)
919
+ self . recv ( buf)
920
+ }
921
+
922
+ fn read_vectored ( & mut self , bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
923
+ self . recv_vectored ( bufs) . map ( |( n, _) | n)
916
924
}
917
925
}
918
926
Original file line number Diff line number Diff line change 7
7
// except according to those terms.
8
8
9
9
use std:: cmp:: min;
10
+ use std:: io:: Write ;
10
11
#[ cfg( not( target_os = "redox" ) ) ]
11
12
use std:: io:: { IoSlice , IoSliceMut } ;
12
- use std:: io:: { Read , Write } ;
13
13
use std:: mem:: { self , size_of, size_of_val, MaybeUninit } ;
14
14
use std:: net:: Shutdown ;
15
15
use std:: net:: { self , Ipv4Addr , Ipv6Addr } ;
@@ -1027,23 +1027,6 @@ impl Socket {
1027
1027
}
1028
1028
}
1029
1029
1030
- impl Read for Socket {
1031
- fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
1032
- <& Socket >:: read ( & mut & * self , buf)
1033
- }
1034
- }
1035
-
1036
- impl < ' a > Read for & ' a Socket {
1037
- fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
1038
- let n = syscall ! ( read(
1039
- self . fd,
1040
- buf. as_mut_ptr( ) as * mut c_void,
1041
- cmp:: min( buf. len( ) , max_len( ) ) ,
1042
- ) ) ?;
1043
- Ok ( n as usize )
1044
- }
1045
- }
1046
-
1047
1030
impl Write for Socket {
1048
1031
fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
1049
1032
<& Socket >:: write ( & mut & * self , buf)
Original file line number Diff line number Diff line change 9
9
use std:: cmp:: { self , min} ;
10
10
use std:: fmt;
11
11
use std:: io;
12
- use std:: io:: { IoSlice , IoSliceMut , Read , Write } ;
12
+ use std:: io:: { IoSlice , IoSliceMut , Write } ;
13
13
use std:: mem:: { self , size_of, size_of_val, MaybeUninit } ;
14
14
use std:: net:: Shutdown ;
15
15
use std:: net:: { self , Ipv4Addr , Ipv6Addr } ;
@@ -884,18 +884,6 @@ impl Socket {
884
884
}
885
885
}
886
886
887
- impl Read for Socket {
888
- fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
889
- <& Socket >:: read ( & mut & * self , buf)
890
- }
891
- }
892
-
893
- impl < ' a > Read for & ' a Socket {
894
- fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
895
- recv ( self . socket , buf, 0 )
896
- }
897
- }
898
-
899
887
impl Write for Socket {
900
888
fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
901
889
<& Socket >:: write ( & mut & * self , buf)
You can’t perform that action at this time.
0 commit comments