@@ -2148,21 +2148,20 @@ pub unsafe trait FromBytes: FromZeros {
2148
2148
/// // These are more bytes than are needed to encode two `Pixel`s.
2149
2149
/// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
2150
2150
///
2151
- /// let ( pixels, rest) = Pixel::slice_from_prefix(bytes, 2).unwrap();
2151
+ /// let pixels = Pixel::slice_from_prefix(bytes, 2).unwrap();
2152
2152
///
2153
2153
/// assert_eq!(pixels, &[
2154
2154
/// Pixel { r: 0, g: 1, b: 2, a: 3 },
2155
2155
/// Pixel { r: 4, g: 5, b: 6, a: 7 },
2156
2156
/// ]);
2157
2157
///
2158
- /// assert_eq!(rest, &[8, 9]);
2159
2158
/// ```
2160
2159
#[ inline]
2161
- fn slice_from_prefix ( bytes : & [ u8 ] , count : usize ) -> Option < ( & [ Self ] , & [ u8 ] ) >
2160
+ fn slice_from_prefix ( bytes : & [ u8 ] , count : usize ) -> Option < & [ Self ] >
2162
2161
where
2163
2162
Self : Sized + NoCell ,
2164
2163
{
2165
- Ref :: < _ , [ Self ] > :: new_slice_from_prefix ( bytes, count) . map ( |( r, b ) | ( r. into_slice ( ) , b ) )
2164
+ Ref :: < _ , [ Self ] > :: new_slice_from_prefix ( bytes, count) . map ( |( r, _b ) | r. into_slice ( ) )
2166
2165
}
2167
2166
2168
2167
/// Interprets the suffix of the given `bytes` as a `&[Self]` with length
@@ -2199,21 +2198,19 @@ pub unsafe trait FromBytes: FromZeros {
2199
2198
/// // These are more bytes than are needed to encode two `Pixel`s.
2200
2199
/// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
2201
2200
///
2202
- /// let (rest, pixels) = Pixel::slice_from_suffix(bytes, 2).unwrap();
2203
- ///
2204
- /// assert_eq!(rest, &[0, 1]);
2201
+ /// let pixels = Pixel::slice_from_suffix(bytes, 2).unwrap();
2205
2202
///
2206
2203
/// assert_eq!(pixels, &[
2207
2204
/// Pixel { r: 2, g: 3, b: 4, a: 5 },
2208
2205
/// Pixel { r: 6, g: 7, b: 8, a: 9 },
2209
2206
/// ]);
2210
2207
/// ```
2211
2208
#[ inline]
2212
- fn slice_from_suffix ( bytes : & [ u8 ] , count : usize ) -> Option < ( & [ u8 ] , & [ Self ] ) >
2209
+ fn slice_from_suffix ( bytes : & [ u8 ] , count : usize ) -> Option < & [ Self ] >
2213
2210
where
2214
2211
Self : Sized + NoCell ,
2215
2212
{
2216
- Ref :: < _ , [ Self ] > :: new_slice_from_suffix ( bytes, count) . map ( |( b , r) | ( b , r. into_slice ( ) ) )
2213
+ Ref :: < _ , [ Self ] > :: new_slice_from_suffix ( bytes, count) . map ( |( _b , r) | r. into_slice ( ) )
2217
2214
}
2218
2215
2219
2216
/// Interprets the given `bytes` as a `&mut [Self]` without copying.
@@ -2301,25 +2298,23 @@ pub unsafe trait FromBytes: FromZeros {
2301
2298
/// // These are more bytes than are needed to encode two `Pixel`s.
2302
2299
/// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
2303
2300
///
2304
- /// let ( pixels, rest) = Pixel::mut_slice_from_prefix(bytes, 2).unwrap();
2301
+ /// let pixels = Pixel::mut_slice_from_prefix(bytes, 2).unwrap();
2305
2302
///
2306
2303
/// assert_eq!(pixels, &[
2307
2304
/// Pixel { r: 0, g: 1, b: 2, a: 3 },
2308
2305
/// Pixel { r: 4, g: 5, b: 6, a: 7 },
2309
2306
/// ]);
2310
2307
///
2311
- /// assert_eq!(rest, &[8, 9]);
2312
- ///
2313
2308
/// pixels[1] = Pixel { r: 0, g: 0, b: 0, a: 0 };
2314
2309
///
2315
2310
/// assert_eq!(bytes, [0, 1, 2, 3, 0, 0, 0, 0, 8, 9]);
2316
2311
/// ```
2317
2312
#[ inline]
2318
- fn mut_slice_from_prefix ( bytes : & mut [ u8 ] , count : usize ) -> Option < ( & mut [ Self ] , & mut [ u8 ] ) >
2313
+ fn mut_slice_from_prefix ( bytes : & mut [ u8 ] , count : usize ) -> Option < & mut [ Self ] >
2319
2314
where
2320
2315
Self : Sized + IntoBytes + NoCell ,
2321
2316
{
2322
- Ref :: < _ , [ Self ] > :: new_slice_from_prefix ( bytes, count) . map ( |( r, b ) | ( r. into_mut_slice ( ) , b ) )
2317
+ Ref :: < _ , [ Self ] > :: new_slice_from_prefix ( bytes, count) . map ( |( r, _b ) | r. into_mut_slice ( ) )
2323
2318
}
2324
2319
2325
2320
/// Interprets the suffix of the given `bytes` as a `&mut [Self]` with length
@@ -2356,9 +2351,7 @@ pub unsafe trait FromBytes: FromZeros {
2356
2351
/// // These are more bytes than are needed to encode two `Pixel`s.
2357
2352
/// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
2358
2353
///
2359
- /// let (rest, pixels) = Pixel::mut_slice_from_suffix(bytes, 2).unwrap();
2360
- ///
2361
- /// assert_eq!(rest, &[0, 1]);
2354
+ /// let pixels = Pixel::mut_slice_from_suffix(bytes, 2).unwrap();
2362
2355
///
2363
2356
/// assert_eq!(pixels, &[
2364
2357
/// Pixel { r: 2, g: 3, b: 4, a: 5 },
@@ -2370,11 +2363,11 @@ pub unsafe trait FromBytes: FromZeros {
2370
2363
/// assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 0, 0, 0, 0]);
2371
2364
/// ```
2372
2365
#[ inline]
2373
- fn mut_slice_from_suffix ( bytes : & mut [ u8 ] , count : usize ) -> Option < ( & mut [ u8 ] , & mut [ Self ] ) >
2366
+ fn mut_slice_from_suffix ( bytes : & mut [ u8 ] , count : usize ) -> Option < & mut [ Self ] >
2374
2367
where
2375
2368
Self : Sized + IntoBytes + NoCell ,
2376
2369
{
2377
- Ref :: < _ , [ Self ] > :: new_slice_from_suffix ( bytes, count) . map ( |( b , r) | ( b , r. into_mut_slice ( ) ) )
2370
+ Ref :: < _ , [ Self ] > :: new_slice_from_suffix ( bytes, count) . map ( |( _b , r) | r. into_mut_slice ( ) )
2378
2371
}
2379
2372
2380
2373
/// Reads a copy of `Self` from `bytes`.
0 commit comments