5 unstable releases
0.3.0 | Jun 22, 2023 |
---|---|
0.2.2 | May 10, 2023 |
0.2.1 | Apr 27, 2017 |
0.2.0 | Feb 1, 2017 |
0.1.0 | Feb 1, 2017 |
#504 in Algorithms
9,058 downloads per month
Used in 12 crates
(11 directly)
17KB
264 lines
rev_lines
This library provides a small Rust Iterator for reading files line by line with a buffer in reverse
Documentation
Documentation is available on Docs.rs.
Example
use std::fs::File;
use rev_lines::RevLines;
let file = File::open("README.md").unwrap();
let rev_lines = RevLines::new(file);
for line in rev_lines {
println!("{:?}", line);
}
lib.rs
:
RevLines
This library provides a small Rust Iterator for reading files or
any BufReader
line by line with buffering in reverse.
Example
use std::fs::File;
use rev_lines::RevLines;
let file = File::open("README.md").unwrap();
let rev_lines = RevLines::new(file);
for line in rev_lines {
println!("{:?}", line);
}
If a line with invalid UTF-8 is encountered, the iterator will return None
next, and stop iterating.
This method uses logic borrowed from uutils/coreutils tail
Dependencies
~245–710KB
~17K SLoC