Trait toml_query::set::TomlValueSetExt
[−]
[src]
pub trait TomlValueSetExt { fn set_with_seperator(
&mut self,
query: &str,
sep: char,
value: Value
) -> Result<Option<Value>>; fn set(&mut self, query: &str, value: Value) -> Result<Option<Value>> { ... } }
Required Methods
fn set_with_seperator(
&mut self,
query: &str,
sep: char,
value: Value
) -> Result<Option<Value>>
&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
Provided Methods
fn set(&mut self, query: &str, value: Value) -> Result<Option<Value>>
Extension function for setting a value from the current toml::Value document
See documentation of TomlValueSetExt::set_with_seperator