(
iter: I,
bound: Option<usize>,
mut collect: F,
)
| 60 | } |
| 61 | |
| 62 | fn try_process_reports<I, T, R, C, F, U>( |
| 63 | iter: I, |
| 64 | bound: Option<usize>, |
| 65 | mut collect: F, |
| 66 | ) -> Result<U, Report<[C]>> |
| 67 | where |
| 68 | I: Iterator<Item = Result<T, R>>, |
| 69 | R: Into<Report<[C]>>, |
| 70 | for<'a> F: FnMut(ReportShunt<'a, I, T, C>) -> U, |
| 71 | { |
| 72 | let mut report = None; |
| 73 | let shunt = ReportShunt { |
| 74 | iter, |
| 75 | report: &mut report, |
| 76 | context_len: 0, |
| 77 | context_bound: bound.unwrap_or(usize::MAX), |
| 78 | _marker: core::marker::PhantomData, |
| 79 | }; |
| 80 | |
| 81 | let value = collect(shunt); |
| 82 | report.map_or_else(|| Ok(value), |report| Err(report)) |
| 83 | } |
| 84 | |
| 85 | /// An extension trait for iterators that enables error-aware collection of items. |
| 86 | /// |
no test coverage detected