diff options
Diffstat (limited to 'README.md')
-rw-r--r--[-rwxr-xr-x] | README.md | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/README.md b/README.md index 0481162..1964c9f 100755..100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # configparser -[![Build Status](https://github.com/QEDK/configparser-rs/actions/workflows/rust.yaml/badge.svg)](https://github.com/QEDK/configparser-rs/actions/workflows/rust.yaml) [![Crates.io](https://img.shields.io/crates/l/configparser?color=black)](LICENSE-MIT) [![Crates.io](https://img.shields.io/crates/v/configparser?color=black)](https://crates.io/crates/configparser) [![Released API docs](https://docs.rs/configparser/badge.svg)](https://docs.rs/configparser) [![Maintenance](https://img.shields.io/maintenance/yes/2022)](https://github.com/QEDK/configparser-rs) +[![Build Status](https://github.com/QEDK/configparser-rs/actions/workflows/rust.yaml/badge.svg)](https://github.com/QEDK/configparser-rs/actions/workflows/rust.yaml) [![Crates.io](https://img.shields.io/crates/l/configparser?color=black)](LICENSE-MIT) [![Crates.io](https://img.shields.io/crates/v/configparser?color=black)](https://crates.io/crates/configparser) [![Released API docs](https://docs.rs/configparser/badge.svg)](https://docs.rs/configparser) [![Maintenance](https://img.shields.io/maintenance/yes/2024)](https://github.com/QEDK/configparser-rs) This crate provides the `Ini` struct which implements a basic configuration language which provides a structure similar to whatβs found in Windows' `ini` files. You can use this to write Rust programs which can be customized by end users easily. @@ -29,7 +29,7 @@ strings as well as files. You can install this easily via `cargo` by including it in your `Cargo.toml` file like: ```TOML [dependencies] -configparser = "3.0.2" +configparser = "3.0.4" ``` ## β Supported datatypes @@ -111,7 +111,7 @@ If you read the above sections carefully, you'll know that 1) all the keys are s manner and 3) we can use `getuint()` to parse the `Uint` value into an `u64`. Let's see that in action. ```rust -use configparser::ini::Ini; +use configparser::ini::{Ini, WriteOptions}; use std::error::Error; fn main() -> Result<(), Box<dyn Error>> { @@ -142,9 +142,14 @@ fn main() -> Result<(), Box<dyn Error>> { let innermap = map["topsecret"].clone(); // Remember that all indexes are stored in lowercase! - // You can easily write the currently stored configuration to a file like: + // You can easily write the currently stored configuration to a file with the `write` method. This creates a compact format with as little spacing as possible: config.write("output.ini"); + // You can write the currently stored configuration with different spacing to a file with the `pretty_write` method: + let write_options = WriteOptions::new_with_params(true, 2, 1); + // or you can use the default configuration as `WriteOptions::new()` + config.pretty_write("pretty_output.ini", &write_options); + // If you want to simply mutate the stored hashmap, you can use get_mut_map() let map = config.get_mut_map(); // You can then use normal HashMap functions on this map at your convenience. @@ -171,16 +176,16 @@ The `Ini` struct offers great support for type conversion and type setting safel You can activate it by adding it as a feature like this: ```TOML [dependencies] -configparser = { version = "3.0.2", features = ["indexmap"] } +configparser = { version = "3.0.4", features = ["indexmap"] } ``` - - *async-std*: Activating the `async-std` feature adds asynchronous functions for reading from (`load_async()`) and - writing to (`write_async()`) files using [async-std](https://crates.io/crates/async-std). + - *tokio*: Activating the `tokio` feature adds asynchronous functions for reading from (`load_async()`) and + writing to (`write_async()`) files using [tokio](https://crates.io/crates/tokio). You can activate it by adding it as a feature like this: ```TOML [dependencies] -configparser = { version = "3.0.2", features = ["async-std"] } +configparser = { version = "3.0.4", features = ["tokio"] } ``` ## π License @@ -201,18 +206,6 @@ additional terms or conditions. ## π Changelog Old changelogs are in [CHANGELOG.md](CHANGELOG.md). -- 2.0.0 - - **BREAKING** Added Python-esque support for `:` as a delimiter. - - :new: Add support for case-sensitive maps with automatic handling under the hood. - - :hammer: Fixed buggy setters which went uncaught, to preserve case-insensitive nature. -- 2.0.1 - - Add first-class support for setting, loading and reading defaults - - New available struct `IniDefault` for fast templating -- 2.1.0 - - π― **BREAKING** Parse keys with higher priority, both brackets `[` and `]` can be part of values now. - - βΉ Only affects current behaviour **iff** your section headers had comments in front of them like, `comment[HEADER]`, you can fix it by adding the comment after the header like `[HEADER]#comment` or otherwise. - - π `load()` and `write()` work with `Path`-like arguments now. - - π Add docs for new struct - 3.0.0 - π
**BREAKING** `IniDefault` is now a non-exhaustive struct, this will make future upgrades easier and non-breaking in nature. This change might also have a few implications in updating your existing codebase, please read the [official docs](https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute) for more guidance. - `IniDefault` is now internally used for generating defaults, reducing crate size. @@ -221,10 +214,18 @@ Old changelogs are in [CHANGELOG.md](CHANGELOG.md). - Uses `CRLF` line endings for Windows files. - Bumps crate to 2021 edition. - Adds features to CI pipeline. -- 3.0.2 (**STABLE**) +- 3.0.2 - Adds support for multi-line key-value pairs. - Adds `async-std` feature for asynchronous file operations. - Some performance optimizations. +- 3.0.3 + - Add default empty line on empty strings. + - Feature to append to existing `Ini` objects. + - Minor lint fixes. +- 3.0.4 (**STABLE**) + - Adds pretty printing functionality + - Replaces `async-std` with `tokio` as the available async runtime + - *The `async-std` feature will be deprecated in a future release* ### π Future plans |