rollup merge of #21053: apasel422/exact
This commit is contained in:
commit
2e9adab528
@ -2409,8 +2409,12 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_chunksator() {
|
||||
use core::iter::ExactSizeIterator;
|
||||
|
||||
let v = &[1i,2,3,4,5];
|
||||
|
||||
assert_eq!(v.chunks(2).len(), 3);
|
||||
|
||||
let chunks: &[&[int]] = &[&[1i,2], &[3,4], &[5]];
|
||||
assert_eq!(v.chunks(2).collect::<Vec<&[int]>>(), chunks);
|
||||
let chunks: &[&[int]] = &[&[1i,2,3], &[4,5]];
|
||||
@ -2675,7 +2679,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_mut_chunks() {
|
||||
use core::iter::ExactSizeIterator;
|
||||
|
||||
let mut v = [0u8, 1, 2, 3, 4, 5, 6];
|
||||
assert_eq!(v.chunks_mut(2).len(), 4);
|
||||
for (i, chunk) in v.chunks_mut(3).enumerate() {
|
||||
for x in chunk.iter_mut() {
|
||||
*x = i as u8;
|
||||
|
@ -1269,6 +1269,9 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
|
||||
|
||||
#[unstable = "trait is experimental"]
|
||||
impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
|
||||
#[inline]
|
||||
@ -1347,6 +1350,8 @@ impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {}
|
||||
|
||||
//
|
||||
// Free functions
|
||||
|
Loading…
Reference in New Issue
Block a user