(&mut self)
| 615 | type Item = &'a Diagnostic; |
| 616 | |
| 617 | fn next(&mut self) -> Option<Self::Item> { |
| 618 | loop { |
| 619 | if let DataFusionError::Diagnostic(diagnostics, source) = self.head { |
| 620 | self.head = source.as_ref(); |
| 621 | return Some(diagnostics); |
| 622 | } |
| 623 | |
| 624 | if let Some(source) = self |
| 625 | .head |
| 626 | .source() |
| 627 | .and_then(|source| source.downcast_ref::<DataFusionError>()) |
| 628 | { |
| 629 | self.head = source; |
| 630 | } else { |
| 631 | return None; |
| 632 | } |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | DiagnosticsIterator { head: self }.next() |