diff options
author | Akshay <[email protected]> | 2020-03-15 16:42:56 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2020-03-15 16:42:56 +0000 |
commit | fda37d21782f7f343203521f7254f1e70f89b1ed (patch) | |
tree | 55482cf00a275e0604afef20b8a0bad05a0b535b | |
parent | 57d5f1b806fdfe2a9db6a37b2761a5291252c76b (diff) |
add sample usage
-rw-r--r-- | readme.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..d3f4ad8 --- /dev/null +++ b/readme.md | |||
@@ -0,0 +1,22 @@ | |||
1 | # fondant | ||
2 | |||
3 | > an experimental, macro-only, boilerplate free, configuration management library | ||
4 | |||
5 | ### example | ||
6 | |||
7 | ```rust | ||
8 | #[derive(Config, Default, Serialize, Deserialize)] | ||
9 | #[filename = "config"] // ~/.config/appconfig/config.toml (XDG spec) | ||
10 | #[extension = "toml"] // possible values: yaml, toml, json | ||
11 | struct AppConfig { | ||
12 | version: u8, | ||
13 | path: String, | ||
14 | } | ||
15 | |||
16 | fn main() { | ||
17 | let mut config = AppConfig::load().unwrap(); | ||
18 | config.version = 3; | ||
19 | config.path = "/home/np".to_string(); | ||
20 | config.store(); | ||
21 | } | ||
22 | ``` | ||