aoclib::input

Function parse_newline_sep_str

source
pub fn parse_newline_sep_str<'a, T>(
    data: &'a str,
) -> Result<impl 'a + Iterator<Item = T>>
where T: 'a + FromStr, <T as FromStr>::Err: Display,
Expand description

Parse the provided data into a stream of T.

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.

See also parse_newline_sep for equivalent functionality for input files.