We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9ce652 commit 6ab07ddCopy full SHA for 6ab07dd
src/config.rs
@@ -151,6 +151,18 @@ impl Config {
151
self.refresh()
152
}
153
154
+ pub fn set_once(&mut self, key: &str, value: Value) -> Result<()> {
155
+ let expr: path::Expression = key.parse()?;
156
+
157
+ // Traverse the cache using the path to (possibly) retrieve a value
158
+ if let Some(ref mut val) = expr.get_mut(&mut self.cache) {
159
+ **val = value;
160
+ } else {
161
+ expr.set(&mut self.cache, value);
162
+ }
163
+ Ok(())
164
165
166
pub fn get<'de, T: Deserialize<'de>>(&self, key: &str) -> Result<T> {
167
// Parse the key into a path expression
168
let expr: path::Expression = key.parse()?;
0 commit comments