| 1 | use core::{iter, ops}; |
| 2 | |
| 3 | use crate::TiSlice; |
| 4 | |
| 5 | /// An iterator over all key-value pairs. |
| 6 | /// |
| 7 | /// This struct is created by the [`TiSlice::iter_enumerated`], |
| 8 | /// [`TiSlice::iter_mut_enumerated`] and [`TiVec::drain_enumerated`] methods. |
| 9 | /// |
| 10 | /// [`TiSlice::iter_enumerated`]: struct.TiSlice.html#method.iter_enumerated |
| 11 | /// [`TiSlice::iter_mut_enumerated`]: struct.TiSlice.html#method.iter_mut_enumerated |
| 12 | /// [`TiVec::drain_enumerated`]: struct.TiVec.html#method.drain_enumerated |
| 13 | pub type TiEnumerated<I, K, V> = iter::Map<iter::Enumerate<I>, fn((usize, V)) -> (K, V)>; |
| 14 | |
| 15 | /// An iterator over all keys. |
| 16 | /// |
| 17 | /// This struct is created by the [`TiSlice::keys`] method. |
| 18 | /// |
| 19 | /// [`TiSlice::keys`]: struct.TiSlice.html#method.keys |
| 20 | pub type TiSliceKeys<K> = iter::Map<ops::Range<usize>, fn(usize) -> K>; |
| 21 | |
| 22 | /// An iterator wrapper for iterators that yields [`TiSlice`] subslice |
| 23 | /// references. |
| 24 | /// |
| 25 | /// [`TiSlice`]: struct.TiSlice.html |
| 26 | pub type TiSliceRefMap<Iter, K, V> = iter::Map<Iter, fn(&[V]) -> &TiSlice<K, V>>; |
| 27 | |
| 28 | /// An iterator wrapper for iterators that yields [`TiSlice`] subslice mutable |
| 29 | /// references. |
| 30 | /// |
| 31 | /// [`TiSlice`]: struct.TiSlice.html |
| 32 | pub type TiSliceMutMap<Iter, K, V> = iter::Map<Iter, fn(&mut [V]) -> &mut TiSlice<K, V>>; |
| 33 | |