| Crates.io | get_config |
| lib.rs | get_config |
| version | 0.1.1 |
| created_at | 2023-03-16 03:12:40.311539+00 |
| updated_at | 2023-03-19 13:16:03.45778+00 |
| description | A simple function to get config from a file |
| homepage | |
| repository | https://github.com/Banyc/get_config |
| max_upload_size | |
| id | 811170 |
| size | 3,145 |
get_configpub 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,
}