Add EntryHeader::insert_with_sep()

This commit is contained in:
Matthias Beyer 2016-02-12 21:57:53 +01:00
parent 54ba22d0ef
commit df9313c599

View file

@ -386,7 +386,11 @@ impl EntryHeader {
* Returns true if header field was set, false if there is already a value
*/
pub fn insert(&mut self, spec: &str, v: Value) -> Result<bool> {
let tokens = EntryHeader::tokenize(spec, '.');
self.insert_with_sep(spec, '.', v)
}
pub fn insert_with_sep(&mut self, spec: &str, sep: char, v: Value) -> Result<bool> {
let tokens = EntryHeader::tokenize(spec, sep);
if tokens.is_err() { // return parser error if any
return tokens.map(|_| false);
}