Skip to main content

parse_records

Function parse_records 

Source
pub fn parse_records(input: &str) -> Records<'_> 
Expand description

Parse every record in an already-in-memory IGC file.

Returns an iterator that borrows input and yields one Record per non-blank line. Blank lines are skipped, and unknown record types are returned as Record::Unrecognised, matching Record::parse_line.

The caller owns the backing buffer, so this composes naturally with std::fs::read_to_string or read_to_string:

let buf = std::fs::read_to_string("flight.igc")?;
let records = igc::parse_records(&buf).collect::<Result<Vec<_>, _>>()?;
println!("parsed {} records", records.len());