LFCM (Linus' Fancy Config Module)
LFCM is a procedural macro crate designed to simplify configuration management in Rust.
With LFCM, you only need to provide a single definition of your configuration structure. The crate then automatically generates a fully functional struct that implements the necessary deserialization logic, allowing you to load configuration files with minimal boilerplate.
Features
- Minimal Boilerplate: Define your config structure once and let the macro handle the rest.
- Automatic Deserialization: Automatically implements the deserialization process for your structs.
- Seamless Integration: Generated structure are rust-native structs and allow for strong typesafety and autocompletion.
Usage
use lfcm::config;
config!{
name = Config;
}
fn main() {
// Load configuration from a file (e.g., config.toml or config.json)
let
println!("API Key: {}", config.api_key);
println!("Port: {}", config.port);
println!("Debug Mode: {}", config.debug_mode);
}
Installation
Add lfcm to your Cargo.toml:
[dependencies]
lfcm = "<whatever version you want, likely the current>"
License
LGPL-3.0
Disclaimer
This is currently a hobby project of mine. This has materialised out of the frustration of having to interact with either 'hard-to-use' or 'no-typesafe-and-no-autocomplete' configuration setups and depending on this frustration I will continue working on this library or not.
Description
Languages
Rust
100%