Add EntryHeader::set_with_sep()
This commit is contained in:
parent
bca0143343
commit
54ba22d0ef
1 changed files with 5 additions and 1 deletions
|
@ -478,7 +478,11 @@ impl EntryHeader {
|
||||||
* will be returned
|
* will be returned
|
||||||
*/
|
*/
|
||||||
pub fn set(&mut self, spec: &str, v: Value) -> Result<Option<Value>> {
|
pub fn set(&mut self, spec: &str, v: Value) -> Result<Option<Value>> {
|
||||||
let tokens = EntryHeader::tokenize(spec, '.');
|
self.set_with_sep(spec, '.', v)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_with_sep(&mut self, spec: &str, sep: char, v: Value) -> Result<Option<Value>> {
|
||||||
|
let tokens = EntryHeader::tokenize(spec, sep);
|
||||||
if tokens.is_err() { // return parser error if any
|
if tokens.is_err() { // return parser error if any
|
||||||
return Err(tokens.err().unwrap());
|
return Err(tokens.err().unwrap());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue