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.
2 parents 66e3f7d + 6ab07dd commit 356f173Copy full SHA for 356f173
src/config.rs
@@ -173,6 +173,18 @@ impl Config {
173
self.refresh()
174
}
175
176
+ pub fn set_once(&mut self, key: &str, value: Value) -> Result<()> {
177
+ let expr: path::Expression = key.parse()?;
178
+
179
+ // Traverse the cache using the path to (possibly) retrieve a value
180
+ if let Some(ref mut val) = expr.get_mut(&mut self.cache) {
181
+ **val = value;
182
+ } else {
183
+ expr.set(&mut self.cache, value);
184
+ }
185
+ Ok(())
186
187
188
pub fn get<'de, T: Deserialize<'de>>(&self, key: &str) -> Result<T> {
189
// Parse the key into a path expression
190
let expr: path::Expression = key.parse()?;
0 commit comments