pub trait TomlValueDeleteExt {
// Required method
fn delete_with_seperator(
&mut self,
query: &str,
sep: char,
) -> Result<Option<Value>>;
// Provided method
fn delete(&mut self, query: &str) -> Result<Option<Value>> { ... }
}
Required Methods§
Sourcefn delete_with_seperator(
&mut self,
query: &str,
sep: char,
) -> Result<Option<Value>>
fn delete_with_seperator( &mut self, query: &str, sep: char, ) -> Result<Option<Value>>
Extension function for deleting a value in the current toml::Value document using a custom seperator.
§Semantics
The function does not delete non-empty data structures. So deleting array
from
array = [ 1 ]
does not work.
§Return value
If the delete operation worked correctly, Ok(Option<Value>)
is returned.
The Option<Value>
part is None
if no value was actually removed as there was no value
there. For example, if you’re deleting table.a
and the Table table
has no key a
, then
Ok(None)
is returned. Also, if you’re deleting from an Array, but there is nothing in the
array, or the array is shorter than the index you’re deleting.
If the delete operation actually removed something from the toml document, this value is
returned as Ok(Some(Value))
.
On failure, Err(e)
is returned