Add EntryHeader::insert_with_sep()
This commit is contained in:
parent
54ba22d0ef
commit
df9313c599
1 changed files with 5 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue