pub trait TomlValueSetExt {
// Required method
fn set_with_seperator(
&mut self,
query: &str,
sep: char,
value: Value,
) -> Result<Option<Value>>;
// Provided method
fn set(&mut self, query: &str, value: Value) -> Result<Option<Value>> { ... }
}Required Methods§
Sourcefn set_with_seperator(
&mut self,
query: &str,
sep: char,
value: Value,
) -> Result<Option<Value>>
fn set_with_seperator( &mut self, query: &str, sep: char, value: Value, ) -> Result<Option<Value>>
Extension function for setting a value in the current toml::Value document using a custom seperator
§Semantics
The function never creates intermediate data structures (Tables or Arrays) in the document.
§Return value
- If the set operation worked correctly,
Ok(None)is returned. - If the set operation replaced an existing value
Ok(Some(old_value))is returned - On failure,
Err(e)is returned:- If the query is
"a.b.c"but there is no table"b": error - If the query is
"a.b.[0]"but “b"is not an array: error - If the query is
"a.b.[3]"but the array at “b"has no index3: error - etc.
- If the query is