:pencil: An INI parser library written in Rust.
| Feature | Implemented? | |----------------------------|--------------------| | Sections support | :heavycheckmark: | | Disabled entry recognition | :heavycheckmark: | | Section nesting support | :x: | | Multi-line support | :x: |
Add this to your Cargo.toml
:
inip = "0.2.6"
ini
; file.ini
[section]
full_name = "Hicaro"
```rust use inip::parser::Parser;
fn main() { let parsedfile = Parser::parse("file.ini").unwrap(); asserteq!(parsedfile["section"]["fullname"], "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.
```ini
; this is a comment
; This is another comment
```
All values must be surrounded by quotes
Valid:
ini
[section]
name = "John Doe"
Invalid:
ini
[section]
name = John Doe
All key names must have one word
Valid:
ini
[credentials]
full_name = "John Doe"
Invalid:
ini
[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 ;
ini
[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.