3 releases

0.1.2 Jan 15, 2023
0.1.1 Aug 30, 2022
0.1.0 Apr 9, 2022

#11 in #powered

Download history 27/week @ 2023-11-20 10/week @ 2023-11-27 11/week @ 2023-12-04 19/week @ 2023-12-11 56/week @ 2023-12-18 18/week @ 2023-12-25 86/week @ 2024-01-01 41/week @ 2024-01-08 13/week @ 2024-01-15 16/week @ 2024-01-22 9/week @ 2024-01-29 14/week @ 2024-02-05 19/week @ 2024-02-12 99/week @ 2024-02-19 80/week @ 2024-02-26 23/week @ 2024-03-04

227 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

16KB
304 lines

parseit

GitHub Workflow Status Crates.io docs.rs Codecov

Simple text file parsing library powered by regex and glob patterns.

// Create a parser to parse sections in Cargo.toml (and optionally Cargo.lock)
let parser = Parser::new(&["Cargo.*"], &["Cargo.toml"], r#"^\[(.*)\]$\n"#).unwrap();

// Parse the files in the manifest directory.
let documents = parser
    .parse(&PathBuf::from(env!("CARGO_MANIFEST_DIR")))
    .unwrap();

// Print results.
for document in documents {
    println!("Path: {}", document.path.to_string_lossy());
    for paragraph in document.paragraphs {
        println!("Title: {}", paragraph.title);
        println!("Contents: {}", paragraph.contents);
        println!();
    }
}

Examples

See examples.

Cargo Features

  • gzip: support reading gzip (.gz) files

License

Licensed under either of Apache License Version 2.0 or The MIT License at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache 2.0 License, shall be dual licensed as above, without any additional terms or conditions.

Copyright © 2022-2023, Orhun Parmaksız

Dependencies

~4.5–6.5MB
~113K SLoC