config_toml

Crates.ioconfig_toml
lib.rsconfig_toml
version0.1.0
created_at2026-01-08 01:33:09.655646+00
updated_at2026-01-08 01:33:09.655646+00
descriptionCreates a structure and instantiate it with values from a chosen toml file or chosen default values.
homepage
repositoryhttps://github.com/pino1536/rust-lib.config_from_toml
max_upload_size
id2029383
size5,574
Pino (pino1536)

documentation

README

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.

Commit count: 7

cargo fmt