pub fn parse_two_phase_reader<'a, A, B, Reader, Filename>(
reader: Reader,
file_name: Filename,
) -> Result<(A, impl 'a + Iterator<Item = B>), TwoPhaseError>
Expand description
Parse the contents of the provided reader into a single instance of A
and a stream of B
.
Often parse_two_phase
or parse_two_phase_str
are more ergonomic.
Lines are batched into clusters separated by blank lines. Once a cluster has been collected, it (and internal newlines) are parsed into an instance of the appropriate type.
As whitespace is potentially significant, it is not adjusted in any way before being handed to the parser.
If any record cannot be parsed, this prints the parse error on stderr and stops iteration.