Improve error handling

This commit is contained in:
Joscha 2021-12-18 18:27:48 +01:00
parent 96f7aa77dc
commit d67bf0aeea
6 changed files with 197 additions and 34 deletions

View file

@ -163,6 +163,12 @@ impl Files {
&self.files[source.file].file.commands[source.command]
}
pub fn file(&self, file: usize) -> Option<(&Path, &str)> {
self.files
.get(file)
.map(|f| (&f.name as &Path, &f.file.contents as &str))
}
/// Add a [`Done`] statement to the task identified by `source`.
///
/// Returns whether the addition was successful. It can fail if the entry