get_config

Crates.ioget_config
lib.rsget_config
version0.1.1
sourcesrc
created_at2023-03-16 03:12:40.311539
updated_at2023-03-19 13:16:03.45778
descriptionA simple function to get config from a file
homepage
repositoryhttps://github.com/Banyc/get_config
max_upload_size
id811170
size3,145
IchHabeKeineNamen (Banyc)

documentation

README

get_config

pub fn main() {
    // There should be either:
    // - a file named `config.toml` in the current directory;
    // - a path passed to `std::env::args().nth(1)`.
    let config: Config = get_config().unwrap();
    println!("{:?}", config);
}
// `Deserialize` is required by `cargo add serde --features derive`
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize)]
struct Config {
    hello: String,
}
Commit count: 9

cargo fmt