https://github.com/hicarod/inip
:pencil: INI parser
https://github.com/hicarod/inip
ini parser rust
Last synced: about 1 year ago
JSON representation
:pencil: INI parser
- Host: GitHub
- URL: https://github.com/hicarod/inip
- Owner: HicaroD
- License: mit
- Created: 2022-03-23T22:11:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-19T19:50:31.000Z (about 4 years ago)
- Last Synced: 2025-06-13T09:44:21.706Z (about 1 year ago)
- Topics: ini, parser, rust
- Language: Rust
- Homepage: https://crates.io/crates/inip
- Size: 103 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# INIp
:pencil: An INI parser library written in Rust.
## Summary
1. [Features](#features)
2. [Installation](#installation)
3. [Examples](#examples)
4. [Rules](#rules)
5. [Contributions](#contributions)
6. [License](#license)
## Features
| Feature | Implemented? |
|----------------------------|--------------------|
| Sections support | :heavy_check_mark: |
| Disabled entry recognition | :heavy_check_mark: |
| Section nesting support | :x: |
| Multi-line support | :x: |
## Installation
Add this to your `Cargo.toml`:
```
inip = "0.2.7"
```
## Example
```ini
; file.ini
[section]
full_name = "Hicaro"
```
```rust
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`](examples).
## Rules
1. 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
# this is not a comment
```
2. All values must be surrounded by quotes
Valid:
```ini
[section]
name = "John Doe"
```
Invalid:
```ini
[section]
name = John Doe
```
3. 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.
4. Disable entry recognition by using `;`
```ini
[credentials]
; full_name = "John Doe"
```
## Contributions
If you find any problems with this library, please let me know by opening an issue explaining the problem.
## License
This project is licensed under the [MIT](LICENSE) license.