What I need is something like slice::windows()
but custom-defined rather than just by size. E.g I'd like have that working:
let data = vec![1,1,3,3,3,2];
for chunk in data.split_by(|current,next| current==next) {
// first iter: [1,1]
// second iter: [3,3,3]
// third iter: [2]
}
Although I may imagine numerous criteria for such splitting, at that moment my actual problem is to split a vector of object into slices where all objects in a slice are (sort of) equal.
For instance, imagine a vector of CustomerAddress
structs; I need slices of objects where zip-code is identical.