Crates.io | parseit |
lib.rs | parseit |
version | 0.1.2 |
source | src |
created_at | 2022-04-09 21:22:42.656969 |
updated_at | 2023-01-15 14:19:08.991058 |
description | Simple text file parsing library powered by regex and glob patterns |
homepage | https://github.com/orhun/parseit |
repository | https://github.com/orhun/parseit |
max_upload_size | |
id | 564864 |
size | 35,734 |
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!();
}
}
See examples.
gzip
: support reading gzip (.gz
) filesLicensed under either of Apache License Version 2.0 or The MIT License at your option.
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