#file-line #line #reverse #iterator #file-reader #buffer #reader

rev_lines

Rust Iterator for reading files line by line with a buffer in reverse

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

#490 in Algorithms

Download history 3164/week @ 2024-07-21 2215/week @ 2024-07-28 3283/week @ 2024-08-04 2963/week @ 2024-08-11 2789/week @ 2024-08-18 3899/week @ 2024-08-25 2442/week @ 2024-09-01 2748/week @ 2024-09-08 2410/week @ 2024-09-15 1877/week @ 2024-09-22 2146/week @ 2024-09-29 1630/week @ 2024-10-06 2119/week @ 2024-10-13 2108/week @ 2024-10-20 1143/week @ 2024-10-27 1671/week @ 2024-11-03

7,139 downloads per month
Used in 10 crates (9 directly)

MIT license

17KB
264 lines

rev_lines

rev-lines MIT licensed crates.io

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

~260–720KB
~17K SLoC