inip

Crates.ioinip
lib.rsinip
version0.2.7
sourcesrc
created_at2022-04-14 12:49:23.931325
updated_at2022-04-19 19:40:48.246272
descriptionA simple INI parser library
homepage
repositoryhttps://github.com/HicaroD/INIp
max_upload_size
id567513
size14,648
Hicro (HicaroD)

documentation

README

INIp

:pencil: An INI parser library written in Rust.

Summary

  1. Features
  2. Installation
  3. Examples
  4. Rules
  5. Contributions
  6. 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

; 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.

Rules

  1. 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
    
  2. All values must be surrounded by quotes

    Valid:

    [section]
    name = "John Doe"
    

    Invalid:

    [section]
    name = John Doe
    
  3. 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.

  4. Disable entry recognition by using ;

    [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.

Commit count: 144

cargo fmt