Maps supplied iterator and attempts to pair each successfully validated item with a corresponding item from the slice. Validation errors will be propagated without looking at them.
(
iter: I,
validator: V,
pair_with: &'pairs [Pair],
)
| 46 | /// with a corresponding item from the slice. |
| 47 | /// Validation errors will be propagated without looking at them. |
| 48 | pub fn pair_valid_items_with_slice<'iter, 'pairs, I, Item, Pair, E, V>( |
| 49 | iter: I, |
| 50 | validator: V, |
| 51 | pair_with: &'pairs [Pair], |
| 52 | ) -> impl Iterator<Item = Result<(&'pairs Pair, Item), E>> + 'iter |
| 53 | where |
| 54 | 'pairs: 'iter, |
| 55 | I: IntoIterator<Item = (usize, Item)> + 'iter, |
| 56 | Item: 'iter, |
| 57 | V: SeqValidator<(usize, Item)> + 'iter, |
| 58 | E: From<IndexIsOutOfBounds> + From<V::Failure> + 'iter, |
| 59 | { |
| 60 | try_pair_with_slice( |
| 61 | validate(iter, validator).map(|res| res.map_err(E::from)), |
| 62 | pair_with, |
| 63 | ) |
| 64 | } |
| 65 | |
| 66 | /// Ensures that the given iterator satisfies provided validator for each item. |
| 67 | /// The supplied option will be modified to `V::Failure` in case of failure, and iteration will be aborted. |
no test coverage detected