aoclib::input

Function parse_str

source
pub fn parse_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.

Each line is treated as a separate record. Leading and trailing spaces are trimmed 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 for equivalent functionality for input files.