Skip to content

About

A minimalism rust macro to load a config.toml to a given struct.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal config.toml Rust Macro

Creates a structure and instantiate it with values from a chosen toml file or chosen default values.

Features

The minimal but powerfull rust marcro to use a toml file as a config.
You can chose a config file path, a struct and default values that will be uses if the key is not found in the config.

Usage

let config = config_toml::Config!(
    "config.toml",                       // File Name
    {                                    // Struct and default values
      value1: String = String::from("Hello Rust"),
      value2: u32 = 7,
      value3: bool = false,
    }
);

println!("Value 1: {}", config.value1);  // Use a config value :)

Example config.toml file:

value1 = "192.168.1.1"
value2 = 4
value3 = true

Notes

{Array} like values and [table] are not supportet at the moment.

About

A minimalism rust macro to load a config.toml to a given struct.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages