Crates.io | configit |
lib.rs | configit |
version | 0.3.1 |
source | src |
created_at | 2022-01-16 03:27:03.00135 |
updated_at | 2022-01-23 10:57:10.097422 |
description | Zero-boilerplate configuration management in Rust |
homepage | https://github.com/ltoddy/configit |
repository | https://github.com/ltoddy/configit |
max_upload_size | |
id | 514618 |
size | 19,495 |
Zero-boilerplate configuration management in Rust
cargo add configit
config.toml
host = "127.0.0.1"
port = 8888
src/main.rs
use serde::{Deserialize, Serialize};
use configit::Loader;
#[derive(Debug, Deserialize)]
pub struct AppConfig {
pub host: String,
pub port: u16,
}
fn main() {
let config = AppConfig::load("config.toml").expect("couldn't load `config.toml` file");
println!("config: {config:?}"); // config: AppConfig { host: "127.0.0.1", port: 8888 }
}