Add EntryHeader::set_with_sep()

This commit is contained in:
Matthias Beyer 2016-02-12 21:56:48 +01:00
parent bca0143343
commit 54ba22d0ef

View file

@ -478,7 +478,11 @@ impl EntryHeader {
* will be returned
*/
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
return Err(tokens.err().unwrap());
}