diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-03-26 16:32:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-26 16:32:54 +0100 |
commit | cbb52d7dbf0a315ec399de620de28953c802a4a1 (patch) | |
tree | 30b07d3af9f8dce07a8fbb8a4be6347c46c1b53d | |
parent | 975d7158b8f0bf1135080dc94162f2f0b6a3b28d (diff) | |
parent | 7d17f9103b2828064fa3aeb79a62da8a6f74bacc (diff) |
Merge pull request #181 from matthiasbeyer/set-doc
Documentation for `Config::set*()`
-rw-r--r-- | src/config.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index 1019061..cfd865a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -139,6 +139,7 @@ impl Config { Ok(self) } + /// Set a default `value` at `key` pub fn set_default<T>(&mut self, key: &str, value: T) -> Result<&mut Config> where T: Into<Value>, @@ -156,6 +157,14 @@ impl Config { self.refresh() } + /// Set an overwrite + /// + /// This function sets an overwrite value. + /// The overwrite `value` is written to the `key` location on every `refresh()` + /// + /// # Warning + /// + /// Errors if config is frozen pub fn set<T>(&mut self, key: &str, value: T) -> Result<&mut Config> where T: Into<Value>, |