@@ -1045,6 +1045,32 @@ impl<'a> IoSliceMut<'a> {
1045
1045
1046
1046
/// Advance the internal cursor of the slice.
1047
1047
///
1048
+ /// Also see [`IoSliceMut::advance_slice`] to advance the cursors of
1049
+ /// multiple buffers.
1050
+ ///
1051
+ /// # Examples
1052
+ ///
1053
+ /// ```
1054
+ /// #![feature(io_slice_advance)]
1055
+ ///
1056
+ /// use std::io::IoSliceMut;
1057
+ /// use std::ops::Deref;
1058
+ ///
1059
+ /// let mut data = [1; 8];
1060
+ /// let mut buf = IoSliceMut::new(&mut data);
1061
+ ///
1062
+ /// // Mark 10 bytes as read.
1063
+ /// buf.advance(3);
1064
+ /// assert_eq!(buf.deref(), [1; 5].as_ref());
1065
+ /// ```
1066
+ #[ unstable( feature = "io_slice_advance" , issue = "62726" ) ]
1067
+ #[ inline]
1068
+ pub fn advance ( & mut self , n : usize ) {
1069
+ self . 0 . advance ( n)
1070
+ }
1071
+
1072
+ /// Advance the internal cursor of the slices.
1073
+ ///
1048
1074
/// # Notes
1049
1075
///
1050
1076
/// Elements in the slice may be modified if the cursor is not advanced to
@@ -1093,7 +1119,7 @@ impl<'a> IoSliceMut<'a> {
1093
1119
1094
1120
* bufs = & mut replace ( bufs, & mut [ ] ) [ remove..] ;
1095
1121
if !bufs. is_empty ( ) {
1096
- bufs[ 0 ] . 0 . advance ( n - accumulated_len)
1122
+ bufs[ 0 ] . advance ( n - accumulated_len)
1097
1123
}
1098
1124
}
1099
1125
}
@@ -1153,6 +1179,32 @@ impl<'a> IoSlice<'a> {
1153
1179
1154
1180
/// Advance the internal cursor of the slice.
1155
1181
///
1182
+ /// Also see [`IoSlice::advance_slice`] to advance the cursors of multiple
1183
+ /// buffers.
1184
+ ///
1185
+ /// # Examples
1186
+ ///
1187
+ /// ```
1188
+ /// #![feature(io_slice_advance)]
1189
+ ///
1190
+ /// use std::io::IoSlice;
1191
+ /// use std::ops::Deref;
1192
+ ///
1193
+ /// let mut data = [1; 8];
1194
+ /// let mut buf = IoSlice::new(&mut data);
1195
+ ///
1196
+ /// // Mark 10 bytes as read.
1197
+ /// buf.advance(3);
1198
+ /// assert_eq!(buf.deref(), [1; 5].as_ref());
1199
+ /// ```
1200
+ #[ unstable( feature = "io_slice_advance" , issue = "62726" ) ]
1201
+ #[ inline]
1202
+ pub fn advance ( & mut self , n : usize ) {
1203
+ self . 0 . advance ( n)
1204
+ }
1205
+
1206
+ /// Advance the internal cursor of the slices.
1207
+ ///
1156
1208
/// # Notes
1157
1209
///
1158
1210
/// Elements in the slice may be modified if the cursor is not advanced to
@@ -1200,7 +1252,7 @@ impl<'a> IoSlice<'a> {
1200
1252
1201
1253
* bufs = & mut replace ( bufs, & mut [ ] ) [ remove..] ;
1202
1254
if !bufs. is_empty ( ) {
1203
- bufs[ 0 ] . 0 . advance ( n - accumulated_len)
1255
+ bufs[ 0 ] . advance ( n - accumulated_len)
1204
1256
}
1205
1257
}
1206
1258
}
0 commit comments