#lines #reverse #reader #buffer #iterator

rev_lines

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

3 unstable releases

Uses old Rust 2015

0.2.1 Apr 27, 2017
0.2.0 Feb 1, 2017
0.1.0 Feb 1, 2017

#686 in Algorithms

Download history 432/week @ 2021-05-28 386/week @ 2021-06-04 530/week @ 2021-06-11 698/week @ 2021-06-18 1021/week @ 2021-06-25 1465/week @ 2021-07-02 907/week @ 2021-07-09 968/week @ 2021-07-16 1397/week @ 2021-07-23 930/week @ 2021-07-30 1043/week @ 2021-08-06 1392/week @ 2021-08-13 1323/week @ 2021-08-20 1676/week @ 2021-08-27 1195/week @ 2021-09-03 1562/week @ 2021-09-10

1,314 downloads per month
Used in 3 crates (2 directly)

MIT license

9KB
142 lines

rev_lines

Travis Build Status crates.io MIT licensed

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

extern crate rev_lines;

use rev_lines::RevLines;

let file = File::open("/path/to/file").unwrap();
let mut rev_lines = RevLines::new(file).unwrap();

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

 extern crate rev_lines;

 use rev_lines::RevLines;
 use std::io::BufReader;
 use std::fs::File;

 fn main() {
     let file = File::open("tests/multi_line_file").unwrap();
     let rev_lines = RevLines::new(BufReader::new(file)).unwrap();

     for line in rev_lines {
         println!("{}", line);
     }
 }

This method uses logic borrowed from uutils/coreutils tail

No runtime deps