@@ -4,9 +4,6 @@ use core::{
4
4
ptr, usize,
5
5
} ;
6
6
7
- #[ cfg( feature = "std" ) ]
8
- use std:: fmt;
9
-
10
7
use alloc:: { boxed:: Box , vec:: Vec } ;
11
8
12
9
/// A trait for values that provide sequential write access to bytes.
@@ -168,48 +165,6 @@ pub trait BufMut {
168
165
/// return an empty slice.
169
166
fn bytes_mut ( & mut self ) -> & mut [ MaybeUninit < u8 > ] ;
170
167
171
- /// Fills `dst` with potentially multiple mutable slices starting at `self`'s
172
- /// current position.
173
- ///
174
- /// If the `BufMut` is backed by disjoint slices of bytes, `bytes_vectored_mut`
175
- /// enables fetching more than one slice at once. `dst` is a slice of
176
- /// mutable `IoSliceMut` references, enabling the slice to be directly used with
177
- /// [`readv`] without any further conversion. The sum of the lengths of all
178
- /// the buffers in `dst` will be less than or equal to
179
- /// `Buf::remaining_mut()`.
180
- ///
181
- /// The entries in `dst` will be overwritten, but the data **contained** by
182
- /// the slices **will not** be modified. If `bytes_vectored_mut` does not fill every
183
- /// entry in `dst`, then `dst` is guaranteed to contain all remaining slices
184
- /// in `self.
185
- ///
186
- /// This is a lower level function. Most operations are done with other
187
- /// functions.
188
- ///
189
- /// # Implementer notes
190
- ///
191
- /// This function should never panic. Once the end of the buffer is reached,
192
- /// i.e., `BufMut::remaining_mut` returns 0, calls to `bytes_vectored_mut` must
193
- /// return 0 without mutating `dst`.
194
- ///
195
- /// Implementations should also take care to properly handle being called
196
- /// with `dst` being a zero length slice.
197
- ///
198
- /// [`readv`]: http://man7.org/linux/man-pages/man2/readv.2.html
199
- #[ cfg( feature = "std" ) ]
200
- fn bytes_vectored_mut < ' a > ( & ' a mut self , dst : & mut [ IoSliceMut < ' a > ] ) -> usize {
201
- if dst. is_empty ( ) {
202
- return 0 ;
203
- }
204
-
205
- if self . has_remaining_mut ( ) {
206
- dst[ 0 ] = IoSliceMut :: from ( self . bytes_mut ( ) ) ;
207
- 1
208
- } else {
209
- 0
210
- }
211
- }
212
-
213
168
/// Transfer bytes into `self` from `src` and advance the cursor by the
214
169
/// number of bytes written.
215
170
///
@@ -890,11 +845,6 @@ macro_rules! deref_forward_bufmut {
890
845
( * * self ) . bytes_mut( )
891
846
}
892
847
893
- #[ cfg( feature = "std" ) ]
894
- fn bytes_vectored_mut<' b>( & ' b mut self , dst: & mut [ IoSliceMut <' b>] ) -> usize {
895
- ( * * self ) . bytes_vectored_mut( dst)
896
- }
897
-
898
848
unsafe fn advance_mut( & mut self , cnt: usize ) {
899
849
( * * self ) . advance_mut( cnt)
900
850
}
@@ -1057,44 +1007,3 @@ impl BufMut for Vec<u8> {
1057
1007
// The existence of this function makes the compiler catch if the BufMut
1058
1008
// trait is "object-safe" or not.
1059
1009
fn _assert_trait_object ( _b : & dyn BufMut ) { }
1060
-
1061
- // ===== impl IoSliceMut =====
1062
-
1063
- /// A buffer type used for `readv`.
1064
- ///
1065
- /// This is a wrapper around an `std::io::IoSliceMut`, but does not expose
1066
- /// the inner bytes in a safe API, as they may point at uninitialized memory.
1067
- ///
1068
- /// This is `repr(transparent)` of the `std::io::IoSliceMut`, so it is valid to
1069
- /// transmute them. However, as the memory might be uninitialized, care must be
1070
- /// taken to not *read* the internal bytes, only *write* to them.
1071
- #[ repr( transparent) ]
1072
- #[ cfg( feature = "std" ) ]
1073
- pub struct IoSliceMut < ' a > ( std:: io:: IoSliceMut < ' a > ) ;
1074
-
1075
- #[ cfg( feature = "std" ) ]
1076
- impl fmt:: Debug for IoSliceMut < ' _ > {
1077
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1078
- f. debug_struct ( "IoSliceMut" )
1079
- . field ( "len" , & self . 0 . len ( ) )
1080
- . finish ( )
1081
- }
1082
- }
1083
-
1084
- #[ cfg( feature = "std" ) ]
1085
- impl < ' a > From < & ' a mut [ u8 ] > for IoSliceMut < ' a > {
1086
- fn from ( buf : & ' a mut [ u8 ] ) -> IoSliceMut < ' a > {
1087
- IoSliceMut ( std:: io:: IoSliceMut :: new ( buf) )
1088
- }
1089
- }
1090
-
1091
- #[ cfg( feature = "std" ) ]
1092
- impl < ' a > From < & ' a mut [ MaybeUninit < u8 > ] > for IoSliceMut < ' a > {
1093
- fn from ( buf : & ' a mut [ MaybeUninit < u8 > ] ) -> IoSliceMut < ' a > {
1094
- IoSliceMut ( std:: io:: IoSliceMut :: new ( unsafe {
1095
- // We don't look at the contents, and `std::io::IoSliceMut`
1096
- // doesn't either.
1097
- mem:: transmute :: < & ' a mut [ MaybeUninit < u8 > ] , & ' a mut [ u8 ] > ( buf)
1098
- } ) )
1099
- }
1100
- }
0 commit comments