pub fn iter_prefixes<T>(slice: &[T]) -> impl DoubleEndedIterator<Item = &[T]>
Expand description
Create an iterator over all prefixes in a slice, smallest first
let val = [1, 2, 3];
let mut it = iter_prefixes(&val);
assert_eq!(it.next(), Some([1].as_slice()));
assert_eq!(it.next(), Some([1, 2].as_slice()));
assert_eq!(it.next(), Some([1, 2, 3].as_slice()));
assert_eq!(it.next(), None);