aoclib::input

Function parse_newline_sep_reader

source
pub fn parse_newline_sep_reader<'a, T, Reader, Filename>(
    reader: Reader,
    file_name: Filename,
) -> Result<impl 'a + Iterator<Item = T>>
where T: FromStr, <T as FromStr>::Err: Display, Reader: 'a + BufRead, Filename: 'a + Display,
Expand description

Parse the contents of the provided reader into a stream of T.

Often parse_newline_sep or parse_newline_sep_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 a T instance.

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.