Open
Description
I tried this code:
pub fn main() {
let slice = &[1, 1, 1, 3, 3, 2, 2, 2];
let mut iter = slice.chunk_by(|a, b| a == b);
assert_eq!(iter.next(), Some(&[1, 1, 1][..]));
assert_eq!(iter.next(), Some(&[3, 3][..]));
let mut iter_clone = iter.clone();
assert_eq!(iter_clone.next(), Some(&[2, 2, 2][..]));
assert_eq!(iter_clone.next(), None);
assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
assert_eq!(iter.next(), None);
}
I expected to see this happen: Code compiles and runs
Instead, this happened: Compilation error by virtue of std::slice::ChunkBy not implementing Clone
If there is a reason that Clone
cannot be supported, I don't understand it.