pub fn read_one(
bytes: &[u8],
sheet: Option<usize>,
recording: Option<usize>,
) -> Result<FlightLog, LogError>Expand description
Reads one record of a file that may hold several: the sheet sheet of a spreadsheet’s workbook
(.xlsx by workbook::read, .xls by xls::read), each sheet read as a file of its own,
or the recording recording of an Entacore AIM raw dump (entacore_raw::read_dump), each
counted from 0. With no choice, a workbook’s one sheet, or of several the one that reads as a
log, or the dump’s one recording. Any other file is read as read reads it, and takes
neither choice.
use hpr_flightdata::import;
let csv = b"Time (s),Baro Alt AGL (m)\n0,0\n0.05,0.2\n";
assert_eq!(import::read_one(csv, None, None)?, import::read(csv)?);
assert!(import::read_one(csv, Some(0), None).is_err());§Errors
LogError::Choice for a choice the file doesn’t take or doesn’t hold, and for a workbook or
a dump read with none that holds no one record: of several sheets, more than one that reads as
a log, or none, or several recordings; the chosen sheet’s, or the one sheet’s, own refusal; a
workbook’s own refusal, as workbook::read’s or xls::read’s; otherwise as read.