There's slice::chunk_by, but no slice::chunk_by_key, which might be helpful because it could:
- Evaluate the "key" once per element and re-use it for subsequent comparisons.
- Supply the "key" in addition to the chunk, avoiding re-computing it.
Here is an inefficient implementation to show how this iterator would be used.
I assume there is a reason why there is no in std::slice::chunk_by_key, but I don't see it so far. Or was this an oversight?