superconf

Crates.iosuperconf
lib.rssuperconf
version0.4.3
sourcesrc
created_at2020-06-11 03:07:40.825624
updated_at2020-11-15 14:29:29.574062
descriptionA barebones configuration file made for low-dependency rust applications.
homepage
repositoryhttps://gitlab.com/Owez/superconf
max_upload_size
id252585
size14,885
Owen Griffiths (Owez)

documentation

README

superconf

A barebones configuration file made for low-dependency rust applications.

Usage

Add to your Cargo.toml file:

[dependancies]
superconf = "0.4"

Examples

Default seperator (space ) demonstration:

use superconf;

let input = "my_key my_value";

println!("{:#?}", superconf::parse(input).unwrap());

Or if you'd like to use a custom seperator like : or =:

use superconf::parse_custom_sep;

let input_equal = "custom=seperator";
let input_colon = "second:string";

println!("Equals seperator: {:#?}", parse_custom_sep(input_equal, '=').unwrap());
println!("Colon seperator: {:#?}", parse_custom_sep(input_colon, ':').unwrap());

Here is a complete syntax demonstration:

# comments are like this
# no seperators are allowed in keys or values
# comments can only be at the start of lines, no end of line comments here

# my_key is the key, my_value is the value
my_key the_value

# you can use seperators as plaintext, just have to be backslashed
your_path /home/user/Cool\ Path/x.txt

Config Conventions

Some conventions commonly used for superconf files:

  • The file naming scheme is snake_case
  • Try to document each line with a comment
  • If commented, space each config part with an empty line seperating it from others. If it is undocumented, you may bunch all config parts together

Motivations

Original motivations for creating

Made this as a quick custom parser to challenge myself a bit and to use for a quick-n-dirty configuration format in the future. It's not the best file format in the world but it gets the job done.

Current/future motivations for maintaining

Maintaining: This library is now being used inside of my ipeer p2p implementation for all .ipeer files so maintaining this library is critical.

Commit count: 0

cargo fmt