| Crates.io | inip |
| lib.rs | inip |
| version | 0.2.7 |
| created_at | 2022-04-14 12:49:23.931325+00 |
| updated_at | 2022-04-19 19:40:48.246272+00 |
| description | A simple INI parser library |
| homepage | |
| repository | https://github.com/HicaroD/INIp |
| max_upload_size | |
| id | 567513 |
| size | 14,648 |
:pencil: An INI parser library written in Rust.
| Feature | Implemented? |
|---|---|
| Sections support | :heavy_check_mark: |
| Disabled entry recognition | :heavy_check_mark: |
| Section nesting support | :x: |
| Multi-line support | :x: |
Add this to your Cargo.toml:
inip = "0.2.7"
; file.ini
[section]
full_name = "Hicaro"
use inip::Parser;
fn main() {
let parsed_file = Parser::parse("file.ini").unwrap();
assert_eq!(parsed_file["section"]["full_name"], "Hicaro".to_string());
}
You can read valid and invalid examples on examples.
Comment lines start with ; or it should be the first non-whitespace character of the line.
; this is a comment
; This is another comment
# this is not a comment
All values must be surrounded by quotes
Valid:
[section]
name = "John Doe"
Invalid:
[section]
name = John Doe
All key names must have one word
Valid:
[credentials]
full_name = "John Doe"
Invalid:
[credentials]
full name = "John Doe"
If you want multiple words on your key name, use whatever style you want, but don't use space to separate that.
Disable entry recognition by using ;
[credentials]
; full_name = "John Doe"
If you find any problems with this library, please let me know by opening an issue explaining the problem.
This project is licensed under the MIT license.