diff options
author | Oliver Schneider <oli-obk@users.noreply.github.com> | 2017-05-09 11:22:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-09 11:22:18 +0200 |
commit | f7f426634368da6e872d260acf31fb664b727e05 (patch) | |
tree | 74fdb9623ff2ff04b1dddf4836331d7a89479624 | |
parent | 58f51ef03b88e06745c4113e13ea2738e1af247d (diff) | |
download | milf-rs-f7f426634368da6e872d260acf31fb664b727e05.tar.gz milf-rs-f7f426634368da6e872d260acf31fb664b727e05.zip |
Allow extracting the location of the error
-rw-r--r-- | src/de.rs | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1063,6 +1063,11 @@ impl<'a> Deserializer<'a> { } impl Error { + /// Produces a (line, column) pair of the position of the error if available + pub fn line_col(&self) -> Option<(usize, usize)> { + self.inner.line.map(|line| (line, self.inner.col)) + } + fn from_kind(kind: ErrorKind) -> Error { Error { inner: Box::new(ErrorInner { |