diff options
author | Nora <nora.widdecke@tu-bs.de> | 2019-02-03 21:07:24 +0100 |
---|---|---|
committer | Nora <nora.widdecke@tu-bs.de> | 2019-02-03 21:07:24 +0100 |
commit | f51b5797787b7c789c93b2c50efc5debb8ef376f (patch) | |
tree | db7d5726e058ae5b50c1abfce8ea434b2af5a401 /src/utils | |
parent | c5901b04bd545f08af585600c86c227fb09dc613 (diff) |
cleanup cursor move
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/fileutil.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/utils/fileutil.rs b/src/utils/fileutil.rs index 3c577e7..0b11115 100644 --- a/src/utils/fileutil.rs +++ b/src/utils/fileutil.rs @@ -46,20 +46,13 @@ pub fn write_cal(cal: &IcalVCalendar) -> io::Result<()> { } } -pub fn read_lines_from_file(filepath: &Path) -> io::Result<impl Iterator<Item = String>> { +pub fn read_lines_from_file(filepath: &Path) -> io::Result<impl DoubleEndedIterator<Item = String>> { let f = fs::File::open(filepath)?; let f = BufReader::new(f); let lines: Result<Vec<String>, io::Error> = f.lines().collect(); lines.map(|result| result.into_iter()) } -pub fn read_lines_from_file_backwards(filepath: &Path) -> io::Result<impl Iterator<Item = String>> { - let f = fs::File::open(filepath)?; - let f = BufReader::new(f); - let lines: Result<Vec<String>, io::Error> = f.lines().collect(); - lines.map(|result| result.into_iter().rev()) -} - pub fn read_file_to_string(path: &Path) -> io::Result<String> { let mut file = fs::File::open(&path)?; let mut contents = String::new(); |