Add EntryHeader::read_with_sep() which allows seperator modification

This commit is contained in:
Matthias Beyer 2016-02-12 21:55:06 +01:00
parent a4fa1bac07
commit bca0143343

View file

@ -581,7 +581,11 @@ impl EntryHeader {
* larger than the array length. * larger than the array length.
*/ */
pub fn read(&self, spec: &str) -> Result<Option<Value>> { pub fn read(&self, spec: &str) -> Result<Option<Value>> {
let tokens = EntryHeader::tokenize(spec, '.'); self.read_with_sep(spec, '.')
}
pub fn read_with_sep(&self, spec: &str, splitchr: char) -> Result<Option<Value>> {
let tokens = EntryHeader::tokenize(spec, splitchr);
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());
} }