Function task_hookrs::import::import_task
source · Expand description
Import a single JSON-formatted Task
Examples found in repository?
src/import.rs (line 41)
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
pub fn import_tasks<BR: BufRead>(r: BR) -> Vec<Result<Task, Error>> {
let mut vt = Vec::new();
for line in r.lines() {
if let Err(err) = line {
vt.push(Err(Error::from(err)));
continue;
}
// Unwrap is safe because of continue above
if line.as_ref().unwrap().is_empty() {
// Empty strings are not usable, and shall be silently ignored
continue;
}
vt.push(import_task(line.unwrap().as_str()));
}
vt
}