7 releases

✓ Uses Rust 2018 edition

0.2.1 Mar 10, 2020
0.2.0 Feb 24, 2020
0.1.2 Feb 20, 2020
0.0.8 Feb 10, 2020
Download history 50/week @ 2020-02-06 42/week @ 2020-02-13 64/week @ 2020-02-20 33/week @ 2020-02-27 35/week @ 2020-03-05 20/week @ 2020-03-12 29/week @ 2020-03-19 14/week @ 2020-03-26

70 downloads per month
Used in 8 crates (2 directly)

MIT/Apache

135KB
652 lines

text-parser

text-parser is a streaming parser for text file based on nom parser combinator.

Crates.io Built with Spacemacs


lib.rs:

Text Reader for large text file.

Example

use gchemol_parser::TextReader;

let mut reader = TextReader::from_path("./tests/files/ch3f.mol2").unwrap();

// read a line into `s`
let mut s = String::new();
reader.read_line(&mut s).unwrap();

// seek a specific line
let _ = reader.seek_line(|line| line.starts_with("@<TRIPOS>")).unwrap();

// split remaining text into chunks (each chunk has 5 lines)
let chunks = reader.chunks(5);

for x in chunks {
    // call nom parser to parse each chunk
    dbg!(x);
}

Dependencies

~6.5MB
~139K SLoC